Another quick check to avoid issues with NPCs.

This commit is contained in:
GJ 2013-08-22 14:45:30 -04:00
parent c31ffa5ab4
commit 1a51b93ec9

View File

@ -13,6 +13,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace; import org.bukkit.block.Furnace;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryEvent; import org.bukkit.event.inventory.InventoryEvent;
import org.bukkit.inventory.FurnaceInventory; import org.bukkit.inventory.FurnaceInventory;
@ -60,7 +61,7 @@ public final class Misc {
} }
public static boolean isNPCEntity(Entity entity) { public static boolean isNPCEntity(Entity entity) {
return (entity == null || entity.hasMetadata("NPC") || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger"))); return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger")));
} }
/** /**