From fe71f43c495021b93f23123ed10746f70ee54625 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 26 Feb 2015 22:41:03 +1100 Subject: [PATCH] Fix block data setting --- .../plot/generator/ClassicPlotManager.java | 4 +- .../plot/util/bukkit/SetBlockFast_1_8.java | 108 ++++++++++++++++-- 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java index 6a0050de8..594f0b182 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java @@ -293,7 +293,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { public boolean claimPlot(final PlotWorld plotworld, final Plot plot) { final PlotBlock unclaim = ((ClassicPlotWorld) plotworld).WALL_BLOCK; final PlotBlock claim = ((ClassicPlotWorld) plotworld).CLAIMED_WALL_BLOCK; - if (claim.equals(unclaim)) { + if (!claim.equals(unclaim)) { setWall(plotworld, plot.id, new PlotBlock[] { claim }); } return true; @@ -303,7 +303,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { public boolean unclaimPlot(final PlotWorld plotworld, final Plot plot) { final PlotBlock unclaim = ((ClassicPlotWorld) plotworld).WALL_BLOCK; final PlotBlock claim = ((ClassicPlotWorld) plotworld).CLAIMED_WALL_BLOCK; - if (claim != unclaim) { + if (!claim.equals(unclaim)) { setWall(plotworld, plot.id, new PlotBlock[] { unclaim }); } return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java index 47d788898..51bb9dd24 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast_1_8.java @@ -129,9 +129,102 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { return; } } - int currentId = world.getBlockAt(x, y, z).getTypeId(); + Block block = world.getBlockAt(x, y, z); + int currentId = block.getTypeId(); if (currentId == id) { - return; + switch(id) { + case 0: + case 2: + case 4: + case 13: + case 14: + case 15: + case 20: + case 21: + case 22: + case 24: + case 25: + case 30: + case 32: + case 37: + case 39: + case 40: + case 41: + case 42: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 54: + case 55: + case 56: + case 57: + case 58: + case 60: + case 61: + case 62: + case 7: + case 8: + case 9: + case 10: + case 11: + case 73: + case 74: + case 75: + case 76: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 87: + case 88: + case 101: + case 102: + case 103: + case 110: + case 112: + case 113: + case 117: + case 121: + case 122: + case 123: + case 124: + case 129: + case 133: + case 138: + case 137: + case 140: + case 165: + case 166: + case 169: + case 170: + case 172: + case 173: + case 174: + case 176: + case 177: + case 181: + case 182: + case 188: + case 189: + case 190: + case 191: + case 192: { + return; + } + } + if (block.getData() == data) { + return; + } + block.setData(data); } switch(currentId) { case 54: @@ -164,17 +257,10 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 33: case 151: case 178: { - final Block block = world.getBlockAt(x, y, z); if (block.getData() == data) { - if (block.getTypeId() != id) { - block.setTypeId(id, false); - } + block.setTypeId(id, false); } else { - if (block.getTypeId() == id) { - block.setData(data, false); - } else { - block.setTypeIdAndData(id, data, false); - } + block.setTypeIdAndData(id, data, false); } return; }