diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-03-24 12:11:28 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-03-24 12:11:28 +0100 |
commit | d6c3fe23e57068ae3e562a2b4a60f5542a4492fe (patch) | |
tree | a471a773539f4c6a73c2e43d81b5f5d7578fd20a /src | |
parent | 748b71b3ccb242c762cb937e6943fe7ea3bdb917 (diff) | |
download | craftbukkit-d6c3fe23e57068ae3e562a2b4a60f5542a4492fe.tar craftbukkit-d6c3fe23e57068ae3e562a2b4a60f5542a4492fe.tar.gz craftbukkit-d6c3fe23e57068ae3e562a2b4a60f5542a4492fe.tar.lz craftbukkit-d6c3fe23e57068ae3e562a2b4a60f5542a4492fe.tar.xz craftbukkit-d6c3fe23e57068ae3e562a2b4a60f5542a4492fe.zip |
Minor logic change and small cleanups
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemInWorldManager.java | 7 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index d21130f8..1c2dc575 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -195,16 +195,17 @@ public class ItemInWorldManager { boolean result = false; if (i1 > 0) { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack); - if (event.useInteractedBlock() == Event.Result.DENY) {
+ if (event.useInteractedBlock() == Event.Result.DENY) { // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. if (i1 == Block.WOODEN_DOOR.id) { boolean bottom = (world.getData(i, j, k) & 8) == 0; - ((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world)));
+ ((EntityPlayer) entityhuman).a.b((Packet) (new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world))); } } else { result = Block.byId[i1].a(world, i, j, k, entityhuman); } - if (itemstack != null && event.useItemInHand() != Event.Result.DENY && (!result || event.useItemInHand() == Event.Result.ALLOW)) { + // If we have 'true' and no explicit deny *or* an explicit allow -- run the item part of the hook + if (itemstack != null && ((!result && event.useItemInHand() != Event.Result.DENY) || event.useItemInHand() == Event.Result.ALLOW)) { result = itemstack.a(entityhuman, world, i, j, k, l); } } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 51d20f43..bc6bc060 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -374,7 +374,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet15Place packet15place) { - // CraftBukkit + // CraftBukkit start // This is a horrible hack needed because the client sends 2 packets on 'right mouse click' // aimed at a block. We shouldn't need to get the second packet if the data is handled // but we cannot know what the client will do, so we might still get it @@ -409,7 +409,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { return; } - // Don't call this event if using Buckets / signs + // CraftBukkit start PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack); if (!event.isCancelled()) { |