13
0
geforkt von Mirrors/Paper

Fix inability to use items under certain circumstances

Dieser Commit ist enthalten in:
Erik Broes 2011-03-25 07:35:47 +01:00
Ursprung f330025f1f
Commit 95c08f854f
2 geänderte Dateien mit 9 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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