From 58cf41bddb684c03b00ecc836596e600ef332302 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 1 Aug 2015 03:01:25 +1000 Subject: [PATCH] Fixes Possible fix for trim: #482 Fixes #480 Possible fix for #481 Reduce plot move debugspam --- .../plot/commands/Trim.java | 2 +- .../plot/util/MainUtil.java | 3 +++ .../bukkit/object/entity/EntityWrapper.java | 24 ++++++++++++++++--- .../bukkit/util/SetBlockFast_1_8.java | 5 ++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index 9d5ff0f27..c7b8ab799 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -134,7 +134,7 @@ public class Trim extends SubCommand { return; } final Plot plot = plots.remove(0); - plots.remove(0); + final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id); final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 501958302..d09707c57 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -351,6 +351,9 @@ public class MainUtil { public static boolean isPlotAreaAbs(final Location location) { final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld()); + if (plotworld == null) { + return false; + } if (plotworld.TYPE == 2) { return ClusterManager.getClusterAbs(location) != null; } diff --git a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java index 87548fcd0..b6a259824 100644 --- a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -58,6 +58,18 @@ public class EntityWrapper { private HorseStats horse; private ArmorStandStats stand; + private int hash; + + @Override + public boolean equals(Object obj) { + return hash == obj.hashCode(); + } + + @Override + public int hashCode() { + return hash; + } + public void storeInventory(final InventoryHolder held) { this.inventory = held.getInventory().getContents().clone(); } @@ -158,6 +170,7 @@ public class EntityWrapper { @SuppressWarnings("deprecation") public EntityWrapper(final org.bukkit.entity.Entity entity, final short depth) { + this.hash = entity.getEntityId(); this.depth = depth; final Location loc = entity.getLocation(); this.yaw = loc.getYaw(); @@ -372,9 +385,6 @@ public class EntityWrapper { if (stand.isSmall()) { this.stand.small = true; } - - - return; } case ENDERMITE: // NEW @@ -421,6 +431,14 @@ public class EntityWrapper { case LEASH_HITCH: { return null; } + case ITEM_FRAME: { + entity = world.spawn(loc, ItemFrame.class); + break; + } + case PAINTING: { + entity = world.spawn(loc, Painting.class); + break; + } default: entity = world.spawnEntity(loc, type); break; diff --git a/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java b/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java index db02a6e64..6306e5f6c 100644 --- a/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java +++ b/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java @@ -114,6 +114,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 54: case 130: case 142: + case 132: case 27: case 137: case 52: @@ -124,6 +125,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 138: case 176: case 177: + case 119: case 63: case 68: case 323: @@ -261,9 +263,11 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { block.setData(data); return; } + // blockstate switch(currentId) { case 54: case 130: + case 132: case 142: case 27: case 137: @@ -279,6 +283,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 68: case 323: case 117: + case 119: case 116: case 28: case 66: