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
This commit is contained in:
Josh 2018-07-20 19:23:39 -04:00 committed by GitHub
parent ae1e58c0ac
commit d673537026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1322,13 +1322,14 @@ public class PlayerEvents extends PlotListener implements Listener {
case WATER_BUCKET: case WATER_BUCKET:
case LAVA_BUCKET: { case LAVA_BUCKET: {
if (event.getBlock().getType() == Material.DROPPER) return; 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());
Location location = BukkitUtil.getLocation(event.getVelocity().toLocation(event.getBlock().getWorld()));
if (location.isPlotRoad()) { if (location.isPlotRoad()) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) { public void onStructureGrow(StructureGrowEvent event) {