This commit is contained in:
SirYwell 2022-06-16 17:30:25 +02:00
parent bbb9965526
commit 79121603ee
4 changed files with 19 additions and 11 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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()));