This commit is contained in:
walterhiggins 2013-01-05 20:22:53 +00:00
parent d07cc7ed0d
commit d7e29eb487

View file

@ -19,14 +19,21 @@ public class ScriptCraftBukkit implements IScriptCraft
// TODO Auto-generated method stub // TODO Auto-generated method stub
putBlock(x,y,z,blockId,meta); putBlock(x,y,z,blockId,meta);
Block block = this.getBlockObjectAt(x, y, z); Block block = this.getBlockObjectAt(x, y, z);
if (block instanceof Sign){ BlockState blockState = block.getState();
Sign sign = (Sign)block; if (blockState instanceof Sign){
Sign sign = (Sign)blockState;
for (int i = 0; i < texts.length;i++){ for (int i = 0; i < texts.length;i++){
sign.setLine(i%4, texts[i]); sign.setLine(i%4, texts[i]);
} }
sign.update(true); 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) /* (non-Javadoc)
* @see net.walterhiggins.scriptcraft.IScriptCraft#putBlock(int, int, int, int, int) * @see net.walterhiggins.scriptcraft.IScriptCraft#putBlock(int, int, int, int, int)
*/ */
@ -46,6 +53,12 @@ public class ScriptCraftBukkit implements IScriptCraft
} }
return null; 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) /* (non-Javadoc)
* @see net.walterhiggins.scriptcraft.IScriptCraft#getBlock(int, int, int) * @see net.walterhiggins.scriptcraft.IScriptCraft#getBlock(int, int, int)
*/ */
@ -70,19 +83,6 @@ public class ScriptCraftBukkit implements IScriptCraft
} }
this.plugin.getLogger().info(message); 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; protected JavaPlugin plugin = null;
public CommandSender invoker = null; public CommandSender invoker = null;