mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-17 13:04:42 +02:00
Double check that a Player is not an NPC when loading profiles
This commit is contained in:
@ -39,13 +39,20 @@ public final class Misc {
|
||||
|
||||
private Misc() {};
|
||||
|
||||
public static boolean isNPCEntity(Entity entity) {
|
||||
public static boolean isNPCEntityExcludingVillagers(Entity entity) {
|
||||
return (entity == null
|
||||
|| (entity.hasMetadata("NPC") && !(entity instanceof Villager))
|
||||
|| (entity instanceof NPC && !(entity instanceof Villager))
|
||||
|| entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
|
||||
}
|
||||
|
||||
public static boolean isNPCIncludingVillagers(Player entity) {
|
||||
return (entity == null
|
||||
|| (entity.hasMetadata("NPC"))
|
||||
|| (entity instanceof NPC)
|
||||
|| entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if two locations are near each other.
|
||||
*
|
||||
|
Reference in New Issue
Block a user