summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimberjaw <timberjaw@gmail.com>2011-02-10 18:15:59 -0800
committerEvilSeph <evilseph@unaligned.org>2011-02-11 20:49:09 -0500
commit348e6c75c73376a32b2bf0cf81a549a3a93cace5 (patch)
treecfd382eec0f86cc0cd411e67379e153b364d1efa /src
parentc097fd9ac546809ab99d8bbbf73b49a8d8e4a880 (diff)
downloadcraftbukkit-348e6c75c73376a32b2bf0cf81a549a3a93cace5.tar
craftbukkit-348e6c75c73376a32b2bf0cf81a549a3a93cace5.tar.gz
craftbukkit-348e6c75c73376a32b2bf0cf81a549a3a93cace5.tar.lz
craftbukkit-348e6c75c73376a32b2bf0cf81a549a3a93cace5.tar.xz
craftbukkit-348e6c75c73376a32b2bf0cf81a549a3a93cace5.zip
Added SIGN_CHANGE event.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index e7b71901..c733545d 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -19,6 +19,7 @@ import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockRightClickEvent;
+import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerItemEvent;
@@ -792,8 +793,21 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
j = packet130updatesign.c;
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
+ // CraftBukkit start - SIGN_CHANGE hook
+ Player player = server.getPlayer(this.e);
+ SignChangeEvent modifyEvent = new SignChangeEvent(org.bukkit.event.Event.Type.SIGN_CHANGE, (CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
+ server.getPluginManager().callEvent(modifyEvent);
+ if (modifyEvent.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) {
+ modifyEvent.setLine(l, "");
+ }
+ }
+ // CraftBukkit end
+
for (int l = 0; l < 4; ++l) {
- tileentitysign.e[l] = packet130updatesign.d[l];
+ tileentitysign.e[l] = modifyEvent.getLine(l); // CraftBukkit
}
tileentitysign.d();