Further null checks

This commit is contained in:
fullwall 2012-12-18 19:28:16 +08:00
parent 02a346eea4
commit 4b1c650704
1 changed files with 4 additions and 0 deletions

View File

@ -14,6 +14,8 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import com.google.common.base.Preconditions;
public class CitizensNPCRegistry implements NPCRegistry {
private final ByIdArray<NPC> npcs = new ByIdArray<NPC>();
private final NPCDataStore saves;
@ -23,6 +25,8 @@ public class CitizensNPCRegistry implements NPCRegistry {
}
public NPC createNPC(EntityType type, int id, String name) {
Preconditions.checkNotNull(name, "name cannot be null");
Preconditions.checkNotNull(type, "type cannot be null");
CitizensNPC npc = getByType(type, id, name);
if (npc == null)
throw new IllegalStateException("Could not create NPC.");