mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-29 12:37:37 +01:00
Allow null in CitizensNPCRegistry#getNPC(Entity)
This commit is contained in:
parent
634dd441cb
commit
d43ee95408
@ -37,7 +37,6 @@ import net.citizensnpcs.npc.entity.CitizensZombieNPC;
|
||||
import net.citizensnpcs.util.ByIdArray;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -140,7 +139,8 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
|
||||
@Override
|
||||
public NPC getNPC(Entity entity) {
|
||||
Validate.notNull(entity);
|
||||
if (entity == null)
|
||||
return null;
|
||||
net.minecraft.server.Entity handle = ((CraftEntity) entity).getHandle();
|
||||
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user