diff options
author | Patrick Seidel <psycowithespn1@aim.com> | 2012-12-27 16:30:08 -0500 |
---|---|---|
committer | GJ <gjmcferrin@gmail.com> | 2013-03-24 14:04:27 -0400 |
commit | 7c40a073d8b173dde3f7c13985b5b587e6158894 (patch) | |
tree | 26ae39e305ac673ff9b20ff20ce9e771f9211cec /src/main/java/net/minecraft | |
parent | b5320429731b10a48d4d9892a5f73c533144cb57 (diff) | |
download | craftbukkit-7c40a073d8b173dde3f7c13985b5b587e6158894.tar craftbukkit-7c40a073d8b173dde3f7c13985b5b587e6158894.tar.gz craftbukkit-7c40a073d8b173dde3f7c13985b5b587e6158894.tar.lz craftbukkit-7c40a073d8b173dde3f7c13985b5b587e6158894.tar.xz craftbukkit-7c40a073d8b173dde3f7c13985b5b587e6158894.zip |
Add ability to change player item in hand. Adds BUKKIT-3318
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerConnection.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 13c27051..00c68615 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -760,6 +760,10 @@ public class PlayerConnection extends Connection { if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) { PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); this.server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex)); + return; + } // CraftBukkit end this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex; |