From 47d5f29ae66e254ff8641f7b49d541580723316d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Aug 2024 22:28:04 +0200 Subject: [PATCH] Fix SmartPlaceListener --- .../features/shieldprinting/ShieldPrinting.java | 3 --- .../features/smartplace/SmartPlaceListener.java | 9 +-------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java index 1aa4149a..28a65a99 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.shieldprinting; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.shieldprinting.impl.*; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.BauMemberUpdateEvent; @@ -45,12 +44,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.util.Vector; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java index a419d20b..d8aaf2c7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java @@ -83,12 +83,6 @@ public class SmartPlaceListener implements Plain, Listener { } private static final Class useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem"); - private static final Class entityPlayer = Reflection.getClass("{nms.server.level}.EntityPlayer"); - private static final Class craftPlayer = Reflection.getClass("{obc}.entity.CraftPlayer"); - private static final Reflection.MethodInvoker getHandle = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer); - private static final Class playerConnectionClazz = Reflection.getClass("{nms.server.network}.PlayerConnection"); - private static final Reflection.FieldAccessor playerConnection = Reflection.getField(entityPlayer, playerConnectionClazz, 0); - private static final Reflection.MethodInvoker packetExecutor = Reflection.getMethod(playerConnectionClazz, null, useItem); private static final Set SMART_PLACING = new HashSet<>(); private static final Set WAS_EXECUTED = new HashSet<>(); @@ -101,7 +95,6 @@ public class SmartPlaceListener implements Plain, Listener { Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null; BlockFace blockFace = rayTraceResult != null ? rayTraceResult.getHitBlockFace() : null; boolean shouldSneak = false; - System.out.println(rayTraceResult + " " + block + " " + blockFace); if (block != null) { ItemStack itemStack = player.getInventory().getItemInMainHand(); if (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) { @@ -155,7 +148,7 @@ public class SmartPlaceListener implements Plain, Listener { @EventHandler public void onBlockPlace(BlockPlaceEvent event) { - if(!Permission.BUILD.hasPermission(event.getPlayer())) return; + if (!Permission.BUILD.hasPermission(event.getPlayer())) return; if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return; if (!SMART_PLACING.contains(event.getPlayer())) { if (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {