Fixed unable to eat/throw

Dieser Commit ist enthalten in:
Erik Broes 2011-03-24 23:27:40 +01:00
Ursprung 92518f4fc0
Commit f330025f1f
2 geänderte Dateien mit 13 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -185,6 +185,12 @@ public class ItemInWorldManager {
public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) { public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) {
int i = itemstack.count; 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); ItemStack itemstack1 = itemstack.a(world, entityhuman);
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) { if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) {

Datei anzeigen

@ -17,6 +17,7 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;
@ -410,9 +411,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
// CraftBukkit start // CraftBukkit start
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack);
if (!event.isCancelled()) {
int itemstackAmount = itemstack.count; int itemstackAmount = itemstack.count;
this.e.c.a(this.e, this.e.world, itemstack); this.e.c.a(this.e, this.e.world, itemstack);
@ -420,7 +418,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// snowballs and so forth, but he does it in a place that doesn't cause the // snowballs and so forth, but he does it in a place that doesn't cause the
// inventory update packet to get sent // inventory update packet to get sent
always = (itemstack.count != itemstackAmount); always = (itemstack.count != itemstackAmount);
}
// CraftBukkit end // CraftBukkit end
} else { } else {
int i = packet15place.a; int i = packet15place.a;