From afb72aa10208095a28fb930560bdec1d73fa4c96 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 10 Jul 2020 17:31:46 +0100 Subject: [PATCH] Don't include eggs with spawn*_eggs* --- .../bukkit/listener/PlayerEvents.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index 96e348f3e..a9cb82336 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -1514,8 +1514,9 @@ public class PlayerEvents extends PlotListener implements Listener { } for (Block block1 : event.getBlocks()) { Location bloc = BukkitUtil.getLocation(block1.getLocation()); - if (bloc.isPlotArea() || bloc.add(relative.getBlockX(), - relative.getBlockY(), relative.getBlockZ()).isPlotArea()) { + if (bloc.isPlotArea() || bloc + .add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()) + .isPlotArea()) { event.setCancelled(true); return; } @@ -1546,8 +1547,8 @@ public class PlayerEvents extends PlotListener implements Listener { return; } } - if (!plot.equals(area.getOwnedPlot(location.add( - relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) { + if (!plot.equals(area.getOwnedPlot( + location.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) { // This branch is only necessary to prevent pistons from extending // if they are: on a plot edge, facing outside the plot, and not // pushing any blocks @@ -1568,8 +1569,9 @@ public class PlayerEvents extends PlotListener implements Listener { } for (Block block1 : event.getBlocks()) { Location bloc = BukkitUtil.getLocation(block1.getLocation()); - if (bloc.isPlotArea() || bloc.add(relative.getBlockX(), - relative.getBlockY(), relative.getBlockZ()).isPlotArea()) { + if (bloc.isPlotArea() || bloc + .add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ()) + .isPlotArea()) { event.setCancelled(true); return; } @@ -1955,7 +1957,7 @@ public class PlayerEvents extends PlotListener implements Listener { } if (event.getAction() == Action.RIGHT_CLICK_AIR) { Material item = event.getMaterial(); - if (item.toString().toLowerCase().endsWith("egg")) { + if (item.toString().toLowerCase().endsWith("_egg")) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); } @@ -1967,7 +1969,7 @@ public class PlayerEvents extends PlotListener implements Listener { if (type == Material.AIR) { type = offType; } - if (type.toString().toLowerCase().endsWith("egg")) { + if (type.toString().toLowerCase().endsWith("_egg")) { Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); if (block != null && block.getType() != Material.AIR) { Location location = BukkitUtil.getLocation(block.getLocation());