diff --git a/src/main/java/net/citizensnpcs/Citizens.java b/src/main/java/net/citizensnpcs/Citizens.java index 2b6fec8ff..cd48ca4df 100644 --- a/src/main/java/net/citizensnpcs/Citizens.java +++ b/src/main/java/net/citizensnpcs/Citizens.java @@ -280,12 +280,14 @@ public class Citizens extends JavaPlugin { Messaging.log("Could not find a name for the NPC with ID '" + id + "'."); continue; } - EntityType type = EntityType.fromName(key.getString("traits.type")); + String unparsedEntityType = key.getString("traits.type"); + EntityType type = EntityType.fromName(unparsedEntityType); if (type == null) { try { - type = EntityType.valueOf(key.getString("traits.type")); + type = EntityType.valueOf(unparsedEntityType); } catch (IllegalArgumentException ex) { - Messaging.log("NPC type not recognized. Did you spell it correctly?"); + Messaging.log("NPC type '" + unparsedEntityType + + "' was not recognized. Did you spell it correctly?"); continue; } } diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPCManager.java b/src/main/java/net/citizensnpcs/npc/CitizensNPCManager.java index 9d40e00bf..9ab533152 100644 --- a/src/main/java/net/citizensnpcs/npc/CitizensNPCManager.java +++ b/src/main/java/net/citizensnpcs/npc/CitizensNPCManager.java @@ -63,7 +63,9 @@ public class CitizensNPCManager implements NPCManager { private int generateUniqueId() { int count = 0; while (getNPC(count++) != null) - ; + ; // TODO: doesn't respect existing save data that might not have + // been loaded. This causes DBs with NPCs that weren't loaded to + // have conflicting primary keys. return count - 1; } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java index dd503a727..0e2c1da7a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java @@ -25,9 +25,9 @@ public class CitizensBlazeNPC extends CitizensMobNPC { public static class EntityBlazeNPC extends EntityBlaze implements NPCHandle { private final CitizensNPC npc; - public EntityBlazeNPC(World world, CitizensNPC npc) { + public EntityBlazeNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java index 9ec9e1219..51c6f808e 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java @@ -25,15 +25,16 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC { public static class EntityCaveSpiderNPC extends EntityCaveSpider implements NPCHandle { private final CitizensNPC npc; - public EntityCaveSpiderNPC(World world, CitizensNPC npc) { + public EntityCaveSpiderNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java index 250729c64..5ecf746bb 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java @@ -25,15 +25,16 @@ public class CitizensChickenNPC extends CitizensMobNPC { public static class EntityChickenNPC extends EntityChicken implements NPCHandle { private final CitizensNPC npc; - public EntityChickenNPC(World world, CitizensNPC npc) { + public EntityChickenNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java index b9e2fdf9e..8a1b3c6d3 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java @@ -25,15 +25,16 @@ public class CitizensCowNPC extends CitizensMobNPC { public static class EntityCowNPC extends EntityCow implements NPCHandle { private final CitizensNPC npc; - public EntityCowNPC(World world, CitizensNPC npc) { + public EntityCowNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java index be1866c93..e2df386e6 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java @@ -26,9 +26,9 @@ public class CitizensCreeperNPC extends CitizensMobNPC { public static class EntityCreeperNPC extends EntityCreeper implements NPCHandle { private final CitizensNPC npc; - public EntityCreeperNPC(World world, CitizensNPC npc) { + public EntityCreeperNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @@ -38,7 +38,8 @@ public class CitizensCreeperNPC extends CitizensMobNPC { } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java index 02815910b..ae2500ad1 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java @@ -25,9 +25,9 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC { public static class EntityEnderDragonNPC extends EntityEnderDragon implements NPCHandle { private final CitizensNPC npc; - public EntityEnderDragonNPC(World world, CitizensNPC npc) { + public EntityEnderDragonNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java index 41a1c6e46..6bb47e530 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java @@ -63,9 +63,9 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable { public static class EntityEndermanNPC extends EntityEnderman implements NPCHandle { private final CitizensNPC npc; - public EntityEndermanNPC(World world, CitizensNPC npc) { + public EntityEndermanNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java index 13862d323..2d56f5e1b 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java @@ -25,9 +25,9 @@ public class CitizensGhastNPC extends CitizensMobNPC { public static class EntityGhastNPC extends EntityGhast implements NPCHandle { private final CitizensNPC npc; - public EntityGhastNPC(World world, CitizensNPC npc) { + public EntityGhastNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java index 001fa0867..db717651b 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java @@ -25,9 +25,9 @@ public class CitizensGiantNPC extends CitizensMobNPC { public static class EntityGiantNPC extends EntityGiantZombie implements NPCHandle { private final CitizensNPC npc; - public EntityGiantNPC(World world, CitizensNPC npc) { + public EntityGiantNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java index ec182aa56..d95ef56c6 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java @@ -25,15 +25,16 @@ public class CitizensIronGolemNPC extends CitizensMobNPC { public static class EntityIronGolemNPC extends EntityIronGolem implements NPCHandle { private final CitizensNPC npc; - public EntityIronGolemNPC(World world, CitizensNPC npc) { + public EntityIronGolemNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java index c547e4a0f..c35ec4211 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java @@ -25,9 +25,9 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC { public static class EntityMagmaCubeNPC extends EntityMagmaCube implements NPCHandle { private final CitizensNPC npc; - public EntityMagmaCubeNPC(World world, CitizensNPC npc) { + public EntityMagmaCubeNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; setSize(3); goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java index cd4284466..5f96b430a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java @@ -25,15 +25,16 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC { public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHandle { private final CitizensNPC npc; - public EntityMushroomCowNPC(World world, CitizensNPC npc) { + public EntityMushroomCowNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java index dc367f275..b60d94af2 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java @@ -25,15 +25,16 @@ public class CitizensOcelotNPC extends CitizensMobNPC { public static class EntityOcelotNPC extends EntityOcelot implements NPCHandle { private final CitizensNPC npc; - public EntityOcelotNPC(World world, CitizensNPC npc) { + public EntityOcelotNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java index 249e3a511..6f77c7e03 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java @@ -52,9 +52,9 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable { public static class EntityPigNPC extends EntityPig implements NPCHandle { private final CitizensNPC npc; - public EntityPigNPC(World world, CitizensNPC npc) { + public EntityPigNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @@ -64,7 +64,8 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable { } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java index b1d129f32..95c4c6ca6 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java @@ -25,9 +25,9 @@ public class CitizensPigZombieNPC extends CitizensMobNPC { public static class EntityPigZombieNPC extends EntityPigZombie implements NPCHandle { private final CitizensNPC npc; - public EntityPigZombieNPC(World world, CitizensNPC npc) { + public EntityPigZombieNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java index 3a375dd81..e24ba91d4 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java @@ -62,15 +62,16 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable { public static class EntitySheepNPC extends EntitySheep implements NPCHandle { private final CitizensNPC npc; - public EntitySheepNPC(World world, CitizensNPC npc) { + public EntitySheepNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java index d206006ba..b024ae7b3 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java @@ -25,15 +25,16 @@ public class CitizensSilverfishNPC extends CitizensMobNPC { public static class EntitySilverfishNPC extends EntitySilverfish implements NPCHandle { private final CitizensNPC npc; - public EntitySilverfishNPC(World world, CitizensNPC npc) { + public EntitySilverfishNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java index dc41e1326..c2eae4409 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java @@ -25,15 +25,16 @@ public class CitizensSkeletonNPC extends CitizensMobNPC { public static class EntitySkeletonNPC extends EntitySkeleton implements NPCHandle { private final CitizensNPC npc; - public EntitySkeletonNPC(World world, CitizensNPC npc) { + public EntitySkeletonNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java index 7b321e875..cb9d40ca7 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java @@ -25,16 +25,17 @@ public class CitizensSlimeNPC extends CitizensMobNPC { public static class EntitySlimeNPC extends EntitySlime implements NPCHandle { private final CitizensNPC npc; - public EntitySlimeNPC(World world, CitizensNPC npc) { + public EntitySlimeNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; setSize(3); goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java index c75a5b989..3780dffe8 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java @@ -25,15 +25,16 @@ public class CitizensSnowmanNPC extends CitizensMobNPC { public static class EntitySnowmanNPC extends EntitySnowman implements NPCHandle { private final CitizensNPC npc; - public EntitySnowmanNPC(World world, CitizensNPC npc) { + public EntitySnowmanNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java index d680a3fb2..2c373f6b0 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java @@ -25,15 +25,16 @@ public class CitizensSpiderNPC extends CitizensMobNPC { public static class EntitySpiderNPC extends EntitySpider implements NPCHandle { private final CitizensNPC npc; - public EntitySpiderNPC(World world, CitizensNPC npc) { + public EntitySpiderNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java index 1d0447ed2..65f6d77d9 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java @@ -25,9 +25,9 @@ public class CitizensSquidNPC extends CitizensMobNPC { public static class EntitySquidNPC extends EntitySquid implements NPCHandle { private final CitizensNPC npc; - public EntitySquidNPC(World world, CitizensNPC npc) { + public EntitySquidNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java index ada621e34..2c1486af4 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java @@ -25,15 +25,16 @@ public class CitizensVillagerNPC extends CitizensMobNPC { public static class EntityVillagerNPC extends EntityVillager implements NPCHandle { private final CitizensNPC npc; - public EntityVillagerNPC(World world, CitizensNPC npc) { + public EntityVillagerNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java index 3543dd106..6af9eb42b 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java @@ -25,15 +25,16 @@ public class CitizensWolfNPC extends CitizensMobNPC { public static class EntityWolfNPC extends EntityWolf implements NPCHandle { private final CitizensNPC npc; - public EntityWolfNPC(World world, CitizensNPC npc) { + public EntityWolfNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } @Override - public void d_() { + public void z_() { + super.z_(); npc.update(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java index 3e48ecbeb..99eeab866 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java @@ -25,9 +25,9 @@ public class CitizensZombieNPC extends CitizensMobNPC { public static class EntityZombieNPC extends EntityZombie implements NPCHandle { private final CitizensNPC npc; - public EntityZombieNPC(World world, CitizensNPC npc) { + public EntityZombieNPC(World world, NPC npc) { super(world); - this.npc = npc; + this.npc = (CitizensNPC) npc; goalSelector = new PathfinderGoalSelector(); targetSelector = new PathfinderGoalSelector(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java index 24df7c961..518914f23 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java @@ -26,9 +26,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHandle { private CitizensNPC npc; public EntityHumanNPC(MinecraftServer minecraftServer, World world, String string, - ItemInWorldManager itemInWorldManager, CitizensNPC npc) { + ItemInWorldManager itemInWorldManager, NPC npc) { super(minecraftServer, world, string, itemInWorldManager); - this.npc = npc; + this.npc = (CitizensNPC) npc; itemInWorldManager.setGameMode(0); NPCSocket socket = new NPCSocket(); diff --git a/src/main/java/net/citizensnpcs/trait/Controllable.java b/src/main/java/net/citizensnpcs/trait/Controllable.java index 07e4071cb..91c69823d 100644 --- a/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -35,11 +35,12 @@ public class Controllable extends Trait implements Runnable, Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { EntityPlayer handle = ((CraftPlayer) event.getPlayer()).getHandle(); - if (event.getAction() == Action.PHYSICAL || !handle.equals(npc.getHandle().passenger)) + Action performed = event.getAction(); + if (performed == Action.PHYSICAL || !handle.equals(npc.getHandle().passenger)) return; - if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) { + if (performed == Action.LEFT_CLICK_AIR || performed == Action.LEFT_CLICK_BLOCK) { jump(); - } else { + } else if (-170F >= event.getPlayer().getLocation().getPitch()) { event.getPlayer().leaveVehicle(); } } @@ -64,5 +65,5 @@ public class Controllable extends Trait implements Runnable, Listener { public void save(DataKey key) { } - private static final double JUMP_VELOCITY = 0.4; + private static final double JUMP_VELOCITY = 0.6; }