From d673537026b6b4a4ef05871ac8fbaa9ab17cb0fe Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 20 Jul 2018 19:23:39 -0400 Subject: [PATCH] fix dispensers previously dispensers were not working at all, this change blocks lava and water and allows dispensers to function normally again on servers with plotsquared. if you were trying to block dispensers launching items into the road however that still is not blocked by this --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 8570b7373..fa4577e26 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1322,12 +1322,13 @@ public class PlayerEvents extends PlotListener implements Listener { case WATER_BUCKET: case LAVA_BUCKET: { if (event.getBlock().getType() == Material.DROPPER) return; + BlockFace targetFace = ((org.bukkit.material.Dispenser) event.getBlock().getState().getData()).getFacing(); + Location location = BukkitUtil.getLocation(event.getBlock().getRelative(targetFace).getLocation()); + if (location.isPlotRoad()) { + event.setCancelled(true); + } } - } - Location location = BukkitUtil.getLocation(event.getVelocity().toLocation(event.getBlock().getWorld())); - if (location.isPlotRoad()) { - event.setCancelled(true); - } + } } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)