diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index bb348e5f2..7273b776e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -233,13 +233,20 @@ public class BlockEventListener implements Listener { plot.debug("Prevented block physics and resent block change because disable-physics = true"); return; } - if (event.getChangedType() == Material.COMPARATOR || PHYSICS_BLOCKS.contains(event.getChangedType())) { + if (event.getChangedType() == Material.COMPARATOR) { if (!plot.getFlag(RedstoneFlag.class)) { event.setCancelled(true); plot.debug("Prevented comparator update because redstone = false"); } return; } + if (PHYSICS_BLOCKS.contains(event.getChangedType())) { + if (plot.getFlag(DisablePhysicsFlag.class)) { + event.setCancelled(true); + plot.debug("Prevented block physics because disable-physics = true"); + } + return; + } if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) { if (PISTONS.contains(block.getType())) { org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData(); @@ -682,28 +689,29 @@ public class BlockEventListener implements Listener { event.setCancelled(true); return; } - if (Tag.ICE.isTagged(block.getType())) { + Material blockType = block.getType(); + if (Tag.ICE.isTagged(blockType)) { if (!plot.getFlag(IceMeltFlag.class)) { plot.debug("Ice could not melt because ice-melt = false"); event.setCancelled(true); } return; } - if (Tag.SNOW.isTagged(block.getType())) { + if (Tag.SNOW.isTagged(blockType)) { if (!plot.getFlag(SnowMeltFlag.class)) { plot.debug("Snow could not melt because snow-melt = false"); event.setCancelled(true); } return; } - if (block.getType() == Material.FARMLAND) { + if (blockType == Material.FARMLAND) { if (!plot.getFlag(SoilDryFlag.class)) { plot.debug("Soil could not dry because soil-dry = false"); event.setCancelled(true); } return; } - if (Tag.CORAL_BLOCKS.isTagged(block.getType())) { + if (Tag.CORAL_BLOCKS.isTagged(blockType) || Tag.CORALS.isTagged(blockType)) { if (!plot.getFlag(CoralDryFlag.class)) { plot.debug("Coral could not dry because coral-dry = false"); event.setCancelled(true); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index be76331a0..cfd4f186b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -140,8 +140,8 @@ public class EntitySpawnListener implements Listener { if (type == EntityType.DROPPED_ITEM) { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { event.setCancelled(true); - return; } + return; } if (type.isAlive()) { event.setCancelled(true); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index e57d40a64..cf527cd58 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -244,8 +244,8 @@ public class PaperListener implements Listener { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { event.setShouldAbortSpawn(true); event.setCancelled(true); - return; } + return; } if (type.isAlive()) { event.setShouldAbortSpawn(true); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 3e9cfa6a3..1ee3d79c8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -852,10 +852,10 @@ public class PlayerEventListener extends PlotListener implements Listener { if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) { return; } - ItemStack current = inv.getItemInHand(); + ItemStack oldItem = inv.getItemInHand(); + ItemMeta oldMeta = oldItem.getItemMeta(); ItemStack newItem = event.getCursor(); ItemMeta newMeta = newItem.getItemMeta(); - ItemMeta oldMeta = newItem.getItemMeta(); if (event.getClick() == ClickType.CREATIVE) { final Plot plot = pp.getCurrentPlot(); @@ -896,7 +896,7 @@ public class PlayerEventListener extends PlotListener implements Listener { } } Material itemType = newItem.getType(); - if (!"[(+NBT)]".equals(newLore) || (current.equals(newItem) && newLore.equals(oldLore))) { + if (!"[(+NBT)]".equals(newLore) || (oldItem.equals(newItem) && newLore.equals(oldLore))) { if (newMeta == null || (itemType != Material.LEGACY_BANNER && itemType != Material.PLAYER_HEAD)) { return; } @@ -953,7 +953,7 @@ public class PlayerEventListener extends PlotListener implements Listener { } } if (cancelled) { - if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem + if ((oldItem.getType() == newItem.getType()) && (oldItem.getDurability() == newItem .getDurability())) { event.setCursor( new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));