From f2d9d4174f9e9472a84ecebb20a18ff6b1a89abb Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sat, 25 Feb 2012 14:47:55 +0100 Subject: [PATCH] CraftSign changes. Addresses BUKKIT-824 - Removed the useless world field. - Made it so changes to a CraftSign (which is a Block*State*) no longer reflect into the world without calling sign.update(). --- .../org/bukkit/craftbukkit/block/CraftSign.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java index 4923887147..ae54e0f492 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -6,26 +6,28 @@ import org.bukkit.block.Sign; import org.bukkit.craftbukkit.CraftWorld; public class CraftSign extends CraftBlockState implements Sign { - private final CraftWorld world; private final TileEntitySign sign; + private final String[] lines; public CraftSign(final Block block) { super(block); - world = (CraftWorld) block.getWorld(); + CraftWorld world = (CraftWorld) block.getWorld(); sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ()); + lines = new String[sign.lines.length]; + System.arraycopy(sign.lines, 0, lines, 0, lines.length); } public String[] getLines() { - return sign.lines; + return lines; } public String getLine(int index) throws IndexOutOfBoundsException { - return sign.lines[index]; + return lines[index]; } public void setLine(int index, String line) throws IndexOutOfBoundsException { - sign.lines[index] = line; + lines[index] = line; } @Override @@ -33,6 +35,7 @@ public class CraftSign extends CraftBlockState implements Sign { boolean result = super.update(force); if (result) { + System.arraycopy(lines, 0, sign.lines, 0, lines.length); sign.update(); }