From c304e775478173de365fd5677dfffc4da577f8a8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:22:28 +0100 Subject: [PATCH 1/2] Fix WorldInteraction --- .../lobby/listener/WorldInteraction.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/de/steamwar/lobby/listener/WorldInteraction.java b/src/de/steamwar/lobby/listener/WorldInteraction.java index 52c7463..51771f6 100644 --- a/src/de/steamwar/lobby/listener/WorldInteraction.java +++ b/src/de/steamwar/lobby/listener/WorldInteraction.java @@ -26,6 +26,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; @@ -71,5 +72,31 @@ public class WorldInteraction extends BasicListener { Player player = event.getPlayer(); player.setVelocity(player.getLocation().getDirection().multiply(5).add(new Vector(0, 1, 0))); } + + @EventHandler + public void onBlockPhysics(BlockPhysicsEvent event) { + if (event.getSourceBlock().getType().name().endsWith("_PRESSURE_PLATE")) { + event.setCancelled(true); + } + if (event.getSourceBlock().getType().name().endsWith("_BUTTON")) { + event.setCancelled(true); + } + if (event.getSourceBlock().getType() == Material.LEVER) { + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + if(ModifyCommand.modifying(event.getPlayer())) { + return; + } + if (event.getClickedBlock() == null) { + return; + } + if (event.getClickedBlock().getType().name().endsWith("_DOOR")) { + event.setCancelled(true); + } + } } -- 2.39.5 From f3874cf9de82f161ba3593d6588393b150028a20 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:25:12 +0100 Subject: [PATCH 2/2] Fix WorldInteraction --- .../lobby/listener/WorldInteraction.java | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/de/steamwar/lobby/listener/WorldInteraction.java b/src/de/steamwar/lobby/listener/WorldInteraction.java index 51771f6..8bef3fc 100644 --- a/src/de/steamwar/lobby/listener/WorldInteraction.java +++ b/src/de/steamwar/lobby/listener/WorldInteraction.java @@ -75,28 +75,7 @@ public class WorldInteraction extends BasicListener { @EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { - if (event.getSourceBlock().getType().name().endsWith("_PRESSURE_PLATE")) { - event.setCancelled(true); - } - if (event.getSourceBlock().getType().name().endsWith("_BUTTON")) { - event.setCancelled(true); - } - if (event.getSourceBlock().getType() == Material.LEVER) { - event.setCancelled(true); - } - } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if(ModifyCommand.modifying(event.getPlayer())) { - return; - } - if (event.getClickedBlock() == null) { - return; - } - if (event.getClickedBlock().getType().name().endsWith("_DOOR")) { - event.setCancelled(true); - } + event.setCancelled(true); } } -- 2.39.5