mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-01 14:08:08 +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.ByIdArray;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -140,7 +139,8 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(Entity entity) {
|
public NPC getNPC(Entity entity) {
|
||||||
Validate.notNull(entity);
|
if (entity == null)
|
||||||
|
return null;
|
||||||
net.minecraft.server.Entity handle = ((CraftEntity) entity).getHandle();
|
net.minecraft.server.Entity handle = ((CraftEntity) entity).getHandle();
|
||||||
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user