summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-25 07:35:47 +0100
committerErik Broes <erikbroes@grum.nl>2011-03-25 07:35:47 +0100
commit95c08f854f162dd552987506fd927e0b56cc5146 (patch)
tree8e31784a0f4b46b8953c602e4075f297863d5911 /src/main/java
parentf330025f1fc00eaaa39a4493a7e13a5394d99fd1 (diff)
downloadcraftbukkit-95c08f854f162dd552987506fd927e0b56cc5146.tar
craftbukkit-95c08f854f162dd552987506fd927e0b56cc5146.tar.gz
craftbukkit-95c08f854f162dd552987506fd927e0b56cc5146.tar.lz
craftbukkit-95c08f854f162dd552987506fd927e0b56cc5146.tar.xz
craftbukkit-95c08f854f162dd552987506fd927e0b56cc5146.zip
Fix inability to use items under certain circumstances
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java11
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java5
2 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index 0dbbe80a..14c0b379 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -186,11 +186,6 @@ public class ItemInWorldManager {
public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) {
int i = itemstack.count;
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_AIR, itemstack);
- if (event.useItemInHand() == Event.Result.DENY) {
- return false;
- }
-
ItemStack itemstack1 = itemstack.a(world, entityhuman);
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) {
@@ -220,10 +215,14 @@ public class ItemInWorldManager {
}
} else {
result = Block.byId[i1].a(world, i, j, k, entityhuman);
+ if (itemstack != null && !result) {
+ result = itemstack.a(entityhuman, world, i, j, k, l);
+ }
}
+
// 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);
+ this.a(entityhuman, world, itemstack);
}
}
return result;
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index f8520e4c..254c682d 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -412,7 +412,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
int itemstackAmount = itemstack.count;
- this.e.c.a(this.e, this.e.world, itemstack);
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack);
+ if (event.useItemInHand() != Event.Result.DENY) {
+ this.e.c.a(this.e, this.e.world, itemstack);
+ }
// CraftBukkit notch decrements the counter by 1 in the above method with food,
// snowballs and so forth, but he does it in a place that doesn't cause the