Added ability to customize NPC zombie adulthood, slime size, and villager profession

This commit is contained in:
CoderTim 2014-10-15 20:44:42 -04:00
parent 25b10f0925
commit 535506393f

View File

@ -25,6 +25,9 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent;
@ -298,9 +301,6 @@ public class NpcManager extends MiniPlugin
{
LivingEntity entity = (LivingEntity) _creature.SpawnEntity(npc.getLocation(), EntityType.valueOf(npc.getDatabaseRecord().getEntityType()));
if (entity instanceof Skeleton && npc.getDatabaseRecord().getEntityMeta() != null)
((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
entity.setCustomNameVisible(true);
if (npc.getDatabaseRecord().getName() != null)
{
@ -326,6 +326,14 @@ public class NpcManager extends MiniPlugin
((Ageable) entity).setAgeLock(true);
}
if (entity instanceof Zombie)
((Zombie) entity).setBaby(!npc.getDatabaseRecord().getAdult());
if (entity instanceof Slime && npc.getDatabaseRecord().getEntityMeta() != null)
((Slime) entity).setSize(Integer.parseInt(npc.getDatabaseRecord().getEntityMeta()));
if (entity instanceof Skeleton && npc.getDatabaseRecord().getEntityMeta() != null)
((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
if (entity instanceof Villager && npc.getDatabaseRecord().getEntityMeta() != null)
((Villager) entity).setProfession(Villager.Profession.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
if (entity instanceof org.bukkit.entity.Creature)
((org.bukkit.entity.Creature) entity).setTarget(null);