From d7e29eb48796ddc9a000cfbe1d6c9d90f762dc43 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sat, 5 Jan 2013 20:22:53 +0000 Subject: [PATCH] Fix issue #10 --- .../scriptcraft/ScriptCraftBukkit.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bukkit/ScriptCraft/src/net/walterhiggins/scriptcraft/ScriptCraftBukkit.java b/bukkit/ScriptCraft/src/net/walterhiggins/scriptcraft/ScriptCraftBukkit.java index 6ac3d9c..ad8ee8a 100644 --- a/bukkit/ScriptCraft/src/net/walterhiggins/scriptcraft/ScriptCraftBukkit.java +++ b/bukkit/ScriptCraft/src/net/walterhiggins/scriptcraft/ScriptCraftBukkit.java @@ -19,14 +19,21 @@ public class ScriptCraftBukkit implements IScriptCraft // TODO Auto-generated method stub putBlock(x,y,z,blockId,meta); Block block = this.getBlockObjectAt(x, y, z); - if (block instanceof Sign){ - Sign sign = (Sign)block; + BlockState blockState = block.getState(); + if (blockState instanceof Sign){ + Sign sign = (Sign)blockState; for (int i = 0; i < texts.length;i++){ sign.setLine(i%4, texts[i]); } sign.update(true); } } + private void _putBlock(World world,int x, int y, int z, int blockId, int meta){ + Block block = world.getBlockAt(x, y, z); + block.setTypeId(blockId); + block.setData((byte)meta); + // TODO - add support for trees. + } /* (non-Javadoc) * @see net.walterhiggins.scriptcraft.IScriptCraft#putBlock(int, int, int, int, int) */ @@ -46,6 +53,12 @@ public class ScriptCraftBukkit implements IScriptCraft } return null; } + private final Block getBlockObjectAt(int x,int y, int z){ + World world = getInvokerWorld(); + if (world != null) + return world.getBlockAt(x, y, z); + return null; + } /* (non-Javadoc) * @see net.walterhiggins.scriptcraft.IScriptCraft#getBlock(int, int, int) */ @@ -70,19 +83,6 @@ public class ScriptCraftBukkit implements IScriptCraft } this.plugin.getLogger().info(message); } - - private void _putBlock(World world,int x, int y, int z, int blockId, int meta){ - Block block = world.getBlockAt(x, y, z); - block.setTypeId(blockId); - block.setData((byte)meta); - - } - private final Block getBlockObjectAt(int x,int y, int z){ - World world = getInvokerWorld(); - if (world != null) - return world.getBlockAt(x, y, z); - return null; - } protected JavaPlugin plugin = null; public CommandSender invoker = null;