mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
clean up
This commit is contained in:
parent
bbb9965526
commit
79121603ee
@ -233,13 +233,20 @@ public class BlockEventListener implements Listener {
|
|||||||
plot.debug("Prevented block physics and resent block change because disable-physics = true");
|
plot.debug("Prevented block physics and resent block change because disable-physics = true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getChangedType() == Material.COMPARATOR || PHYSICS_BLOCKS.contains(event.getChangedType())) {
|
if (event.getChangedType() == Material.COMPARATOR) {
|
||||||
if (!plot.getFlag(RedstoneFlag.class)) {
|
if (!plot.getFlag(RedstoneFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
plot.debug("Prevented comparator update because redstone = false");
|
plot.debug("Prevented comparator update because redstone = false");
|
||||||
}
|
}
|
||||||
return;
|
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 (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) {
|
||||||
if (PISTONS.contains(block.getType())) {
|
if (PISTONS.contains(block.getType())) {
|
||||||
org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData();
|
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Tag.ICE.isTagged(block.getType())) {
|
Material blockType = block.getType();
|
||||||
|
if (Tag.ICE.isTagged(blockType)) {
|
||||||
if (!plot.getFlag(IceMeltFlag.class)) {
|
if (!plot.getFlag(IceMeltFlag.class)) {
|
||||||
plot.debug("Ice could not melt because ice-melt = false");
|
plot.debug("Ice could not melt because ice-melt = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Tag.SNOW.isTagged(block.getType())) {
|
if (Tag.SNOW.isTagged(blockType)) {
|
||||||
if (!plot.getFlag(SnowMeltFlag.class)) {
|
if (!plot.getFlag(SnowMeltFlag.class)) {
|
||||||
plot.debug("Snow could not melt because snow-melt = false");
|
plot.debug("Snow could not melt because snow-melt = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (block.getType() == Material.FARMLAND) {
|
if (blockType == Material.FARMLAND) {
|
||||||
if (!plot.getFlag(SoilDryFlag.class)) {
|
if (!plot.getFlag(SoilDryFlag.class)) {
|
||||||
plot.debug("Soil could not dry because soil-dry = false");
|
plot.debug("Soil could not dry because soil-dry = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Tag.CORAL_BLOCKS.isTagged(block.getType())) {
|
if (Tag.CORAL_BLOCKS.isTagged(blockType) || Tag.CORALS.isTagged(blockType)) {
|
||||||
if (!plot.getFlag(CoralDryFlag.class)) {
|
if (!plot.getFlag(CoralDryFlag.class)) {
|
||||||
plot.debug("Coral could not dry because coral-dry = false");
|
plot.debug("Coral could not dry because coral-dry = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -140,8 +140,8 @@ public class EntitySpawnListener implements Listener {
|
|||||||
if (type == EntityType.DROPPED_ITEM) {
|
if (type == EntityType.DROPPED_ITEM) {
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (type.isAlive()) {
|
if (type.isAlive()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -244,8 +244,8 @@ public class PaperListener implements Listener {
|
|||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (type.isAlive()) {
|
if (type.isAlive()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
|
@ -852,10 +852,10 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) {
|
if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack current = inv.getItemInHand();
|
ItemStack oldItem = inv.getItemInHand();
|
||||||
|
ItemMeta oldMeta = oldItem.getItemMeta();
|
||||||
ItemStack newItem = event.getCursor();
|
ItemStack newItem = event.getCursor();
|
||||||
ItemMeta newMeta = newItem.getItemMeta();
|
ItemMeta newMeta = newItem.getItemMeta();
|
||||||
ItemMeta oldMeta = newItem.getItemMeta();
|
|
||||||
|
|
||||||
if (event.getClick() == ClickType.CREATIVE) {
|
if (event.getClick() == ClickType.CREATIVE) {
|
||||||
final Plot plot = pp.getCurrentPlot();
|
final Plot plot = pp.getCurrentPlot();
|
||||||
@ -896,7 +896,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Material itemType = newItem.getType();
|
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)) {
|
if (newMeta == null || (itemType != Material.LEGACY_BANNER && itemType != Material.PLAYER_HEAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -953,7 +953,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem
|
if ((oldItem.getType() == newItem.getType()) && (oldItem.getDurability() == newItem
|
||||||
.getDurability())) {
|
.getDurability())) {
|
||||||
event.setCursor(
|
event.setCursor(
|
||||||
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
||||||
|
Loading…
Reference in New Issue
Block a user