diff options
author | Tahg <tahgtahv@gmail.com> | 2011-04-28 01:29:36 -0400 |
---|---|---|
committer | Tahg <tahgtahv@gmail.com> | 2011-04-28 01:30:15 -0400 |
commit | 97c5f2bb8eaf6037fb5435b59dfe434819aa24cd (patch) | |
tree | 76d0be74ffff584f0261451862a68cc897790e14 /src/main/java/net/minecraft/server/NetServerHandler.java | |
parent | b054cfdda78d92687260dd169f33876c4f315e80 (diff) | |
download | craftbukkit-97c5f2bb8eaf6037fb5435b59dfe434819aa24cd.tar craftbukkit-97c5f2bb8eaf6037fb5435b59dfe434819aa24cd.tar.gz craftbukkit-97c5f2bb8eaf6037fb5435b59dfe434819aa24cd.tar.lz craftbukkit-97c5f2bb8eaf6037fb5435b59dfe434819aa24cd.tar.xz craftbukkit-97c5f2bb8eaf6037fb5435b59dfe434819aa24cd.zip |
improved sign handling
Diffstat (limited to 'src/main/java/net/minecraft/server/NetServerHandler.java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index e732d9d5..7c4ee114 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -855,69 +855,59 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit start if (((WorldServer) this.player.world).isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) { TileEntity tileentity = ((WorldServer) this.player.world).getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z); - // CraftBukkit end if (tileentity instanceof TileEntitySign) { TileEntitySign tileentitysign = (TileEntitySign) tileentity; if (!tileentitysign.a()) { this.minecraftServer.c("Player " + this.player.name + " just tried to change non-editable sign"); + this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); return; } - } - int i; - int j; + int i; + int j; - for (j = 0; j < 4; ++j) { - boolean flag = true; + for (j = 0; j < 4; ++j) { + boolean flag = true; - if (packet130updatesign.lines[j].length() > 15) { - flag = false; - } else { - for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { - if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { - flag = false; + if (packet130updatesign.lines[j].length() > 15) { + flag = false; + } else { + for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { + if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { + flag = false; + } } } - } - if (!flag) { - packet130updatesign.lines[j] = "!?"; + if (!flag) { + packet130updatesign.lines[j] = "!?"; + } } - } - - if (tileentity instanceof TileEntitySign) { - j = packet130updatesign.x; - int k = packet130updatesign.y; - i = packet130updatesign.z; - TileEntitySign tileentitysign1 = (TileEntitySign) tileentity; + if (tileentity instanceof TileEntitySign) { + j = packet130updatesign.x; + int k = packet130updatesign.y; + i = packet130updatesign.z; - // CraftBukkit start - SIGN_CHANGE hook - Player player = server.getPlayer(this.player); - SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines); - server.getPluginManager().callEvent(event); + Player player = server.getPlayer(this.player); + SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines); + server.getPluginManager().callEvent(event); - if (event.isCancelled()) { - // Normally we would return here, but we have to update the sign with blank text if it's been cancelled - // Otherwise the client will have bad text on their sign (client shows text changes as they type) - for (int l = 0; l < 4; ++l) { - event.setLine(l, ""); + if (!event.isCancelled()) { + for (int l = 0; l < 4; ++l) { + tileentitysign.lines[l] = event.getLine(l); + } + tileentitysign.setEditable(false); } - } - // CraftBukkit end - for (int l = 0; l < 4; ++l) { - tileentitysign1.lines[l] = event.getLine(l); - // CraftBukkit + tileentitysign.update(); + ((WorldServer) this.player.world).notify(j, k, i); } - - tileentitysign1.update(); - // CraftBukkit - ((WorldServer) this.player.world).notify(j, k, i); } } + // CraftBukkit end } public boolean c() { |