From 6c93fad8794c29b178a0ebd7944ff92853bf898b Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 12 Aug 2012 14:39:44 +0800 Subject: [PATCH] Check for null in getBukkitEntity() fix issue in Text --- src/main/java/net/citizensnpcs/npc/CitizensNPC.java | 2 ++ .../net/citizensnpcs/npc/ai/CitizensNavigator.java | 12 ++++++++++-- .../citizensnpcs/npc/entity/CitizensBlazeNPC.java | 2 +- .../npc/entity/CitizensCaveSpiderNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensChickenNPC.java | 2 +- .../net/citizensnpcs/npc/entity/CitizensCowNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensCreeperNPC.java | 2 +- .../npc/entity/CitizensEnderDragonNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensEndermanNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensGhastNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensGiantNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensHumanNPC.java | 2 ++ .../npc/entity/CitizensIronGolemNPC.java | 2 +- .../npc/entity/CitizensMagmaCubeNPC.java | 2 +- .../npc/entity/CitizensMushroomCowNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensOcelotNPC.java | 2 +- .../net/citizensnpcs/npc/entity/CitizensPigNPC.java | 2 +- .../npc/entity/CitizensPigZombieNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSheepNPC.java | 2 +- .../npc/entity/CitizensSilverfishNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSkeletonNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSlimeNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSnowmanNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSpiderNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensSquidNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensVillagerNPC.java | 2 +- .../net/citizensnpcs/npc/entity/CitizensWolfNPC.java | 2 +- .../citizensnpcs/npc/entity/CitizensZombieNPC.java | 2 +- .../net/citizensnpcs/npc/entity/EntityHumanNPC.java | 4 +++- src/main/java/net/citizensnpcs/trait/text/Text.java | 2 +- 30 files changed, 43 insertions(+), 29 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index fd9a92c7a..ee55d9f60 100644 --- a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -50,6 +50,8 @@ public abstract class CitizensNPC extends AbstractNPC { @Override public LivingEntity getBukkitEntity() { + if (getHandle() == null) + return null; return (LivingEntity) getHandle().getBukkitEntity(); } diff --git a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java index ae5d447fa..392ae1287 100644 --- a/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -53,12 +53,12 @@ public class CitizensNavigator implements Navigator { @Override public Location getTargetAsLocation() { - return executing.getTargetAsLocation(); + return isNavigating() ? executing.getTargetAsLocation() : null; } @Override public TargetType getTargetType() { - return executing.getTargetType(); + return isNavigating() ? executing.getTargetType() : null; } @Override @@ -98,6 +98,10 @@ public class CitizensNavigator implements Navigator { public void setTarget(LivingEntity target, boolean aggressive) { if (!npc.isSpawned()) throw new IllegalStateException("npc is not spawned"); + if (target == null) { + cancelNavigation(); + return; + } PathStrategy newStrategy = new MCTargetStrategy(npc, target, aggressive, speed); switchStrategyTo(newStrategy); } @@ -106,6 +110,10 @@ public class CitizensNavigator implements Navigator { public void setTarget(Location target) { if (!npc.isSpawned()) throw new IllegalStateException("npc is not spawned"); + if (target == null) { + cancelNavigation(); + return; + } PathStrategy newStrategy = new MCNavigationStrategy(npc, target, speed); switchStrategyTo(newStrategy); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java index 15a6ff1f7..e8fe0f9ab 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensBlazeNPC.java @@ -21,7 +21,7 @@ public class CitizensBlazeNPC extends CitizensMobNPC { @Override public Blaze getBukkitEntity() { - return (Blaze) getHandle().getBukkitEntity(); + return (Blaze) super.getBukkitEntity(); } public static class EntityBlazeNPC extends EntityBlaze implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java index 5aca32e7f..ab5e2dc4d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCaveSpiderNPC.java @@ -21,7 +21,7 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC { @Override public CaveSpider getBukkitEntity() { - return (CaveSpider) getHandle().getBukkitEntity(); + return (CaveSpider) super.getBukkitEntity(); } public static class EntityCaveSpiderNPC extends EntityCaveSpider implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java index a4520aa8e..88d3f4c12 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensChickenNPC.java @@ -21,7 +21,7 @@ public class CitizensChickenNPC extends CitizensMobNPC { @Override public Chicken getBukkitEntity() { - return (Chicken) getHandle().getBukkitEntity(); + return (Chicken) super.getBukkitEntity(); } public static class EntityChickenNPC extends EntityChicken implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java index 9b8a24118..1b8d791d4 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCowNPC.java @@ -21,7 +21,7 @@ public class CitizensCowNPC extends CitizensMobNPC { @Override public Cow getBukkitEntity() { - return (Cow) getHandle().getBukkitEntity(); + return (Cow) super.getBukkitEntity(); } public static class EntityCowNPC extends EntityCow implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java index e65a0fe28..4b40e74ac 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensCreeperNPC.java @@ -22,7 +22,7 @@ public class CitizensCreeperNPC extends CitizensMobNPC { @Override public Creeper getBukkitEntity() { - return (Creeper) getHandle().getBukkitEntity(); + return (Creeper) super.getBukkitEntity(); } public static class EntityCreeperNPC extends EntityCreeper implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java index 850417820..4ca77428a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensEnderDragonNPC.java @@ -21,7 +21,7 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC { @Override public EnderDragon getBukkitEntity() { - return (EnderDragon) getHandle().getBukkitEntity(); + return (EnderDragon) super.getBukkitEntity(); } public static class EntityEnderDragonNPC extends EntityEnderDragon implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java index df81788c4..68c039426 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensEndermanNPC.java @@ -59,7 +59,7 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable { @Override public Enderman getBukkitEntity() { - return (Enderman) getHandle().getBukkitEntity(); + return (Enderman) super.getBukkitEntity(); } public static class EntityEndermanNPC extends EntityEnderman implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java index 838580c5f..b78fdc83c 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensGhastNPC.java @@ -21,7 +21,7 @@ public class CitizensGhastNPC extends CitizensMobNPC { @Override public Ghast getBukkitEntity() { - return (Ghast) getHandle().getBukkitEntity(); + return (Ghast) super.getBukkitEntity(); } public static class EntityGhastNPC extends EntityGhast implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java index a8d653701..9b69f12e3 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensGiantNPC.java @@ -21,7 +21,7 @@ public class CitizensGiantNPC extends CitizensMobNPC { @Override public Giant getBukkitEntity() { - return (Giant) getHandle().getBukkitEntity(); + return (Giant) super.getBukkitEntity(); } public static class EntityGiantNPC extends EntityGiantZombie implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensHumanNPC.java index 6fd40ea62..765d0fe6f 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensHumanNPC.java @@ -116,6 +116,8 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable { @Override public Player getBukkitEntity() { + if (getHandle() == null) + return null; return getHandle().getBukkitEntity(); } diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java index 2e324bd97..91fbfb445 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensIronGolemNPC.java @@ -21,7 +21,7 @@ public class CitizensIronGolemNPC extends CitizensMobNPC { @Override public IronGolem getBukkitEntity() { - return (IronGolem) getHandle().getBukkitEntity(); + return (IronGolem) super.getBukkitEntity(); } public static class EntityIronGolemNPC extends EntityIronGolem implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java index 5cfdcded7..c34c851b8 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensMagmaCubeNPC.java @@ -21,7 +21,7 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC { @Override public MagmaCube getBukkitEntity() { - return (MagmaCube) getHandle().getBukkitEntity(); + return (MagmaCube) super.getBukkitEntity(); } public static class EntityMagmaCubeNPC extends EntityMagmaCube implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java index f16ae8454..9e3c84b7a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensMushroomCowNPC.java @@ -21,7 +21,7 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC { @Override public MushroomCow getBukkitEntity() { - return (MushroomCow) getHandle().getBukkitEntity(); + return (MushroomCow) super.getBukkitEntity(); } public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java index 2517fa3ce..0b3e4110f 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensOcelotNPC.java @@ -21,7 +21,7 @@ public class CitizensOcelotNPC extends CitizensMobNPC { @Override public Ocelot getBukkitEntity() { - return (Ocelot) getHandle().getBukkitEntity(); + return (Ocelot) super.getBukkitEntity(); } public static class EntityOcelotNPC extends EntityOcelot implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java index 4e42a0e86..c7a12954d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigNPC.java @@ -48,7 +48,7 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable { @Override public Pig getBukkitEntity() { - return (Pig) getHandle().getBukkitEntity(); + return (Pig) super.getBukkitEntity(); } public static class EntityPigNPC extends EntityPig implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java index dd7071500..dc46a88e3 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensPigZombieNPC.java @@ -21,7 +21,7 @@ public class CitizensPigZombieNPC extends CitizensMobNPC { @Override public PigZombie getBukkitEntity() { - return (PigZombie) getHandle().getBukkitEntity(); + return (PigZombie) super.getBukkitEntity(); } public static class EntityPigZombieNPC extends EntityPigZombie implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java index 70b4dd8b6..2532f6de1 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSheepNPC.java @@ -59,7 +59,7 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable { @Override public Sheep getBukkitEntity() { - return (Sheep) getHandle().getBukkitEntity(); + return (Sheep) super.getBukkitEntity(); } public static class EntitySheepNPC extends EntitySheep implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java index 70a0e60bc..ffa1f5247 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSilverfishNPC.java @@ -21,7 +21,7 @@ public class CitizensSilverfishNPC extends CitizensMobNPC { @Override public Silverfish getBukkitEntity() { - return (Silverfish) getHandle().getBukkitEntity(); + return (Silverfish) super.getBukkitEntity(); } public static class EntitySilverfishNPC extends EntitySilverfish implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java index e63ba34a7..7fa5a2835 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSkeletonNPC.java @@ -21,7 +21,7 @@ public class CitizensSkeletonNPC extends CitizensMobNPC { @Override public Skeleton getBukkitEntity() { - return (Skeleton) getHandle().getBukkitEntity(); + return (Skeleton) super.getBukkitEntity(); } public static class EntitySkeletonNPC extends EntitySkeleton implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java index 50735cb1c..dec2c6da4 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSlimeNPC.java @@ -21,7 +21,7 @@ public class CitizensSlimeNPC extends CitizensMobNPC { @Override public Slime getBukkitEntity() { - return (Slime) getHandle().getBukkitEntity(); + return (Slime) super.getBukkitEntity(); } public static class EntitySlimeNPC extends EntitySlime implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java index 47190befb..8a0f04bae 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSnowmanNPC.java @@ -21,7 +21,7 @@ public class CitizensSnowmanNPC extends CitizensMobNPC { @Override public Snowman getBukkitEntity() { - return (Snowman) getHandle().getBukkitEntity(); + return (Snowman) super.getBukkitEntity(); } public static class EntitySnowmanNPC extends EntitySnowman implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java index 83636be20..351c33ddd 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSpiderNPC.java @@ -20,7 +20,7 @@ public class CitizensSpiderNPC extends CitizensMobNPC { @Override public Spider getBukkitEntity() { - return (Spider) getHandle().getBukkitEntity(); + return (Spider) super.getBukkitEntity(); } public static class EntitySpiderNPC extends EntitySpider implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java index 89a69b0e3..777a5be78 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensSquidNPC.java @@ -21,7 +21,7 @@ public class CitizensSquidNPC extends CitizensMobNPC { @Override public Squid getBukkitEntity() { - return (Squid) getHandle().getBukkitEntity(); + return (Squid) super.getBukkitEntity(); } public static class EntitySquidNPC extends EntitySquid implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java index 518d37f8f..2f8da6fc7 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensVillagerNPC.java @@ -22,7 +22,7 @@ public class CitizensVillagerNPC extends CitizensMobNPC { @Override public Villager getBukkitEntity() { - return (Villager) getHandle().getBukkitEntity(); + return (Villager) super.getBukkitEntity(); } public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java index 5e4ecd290..43a67ad6c 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensWolfNPC.java @@ -21,7 +21,7 @@ public class CitizensWolfNPC extends CitizensMobNPC { @Override public Wolf getBukkitEntity() { - return (Wolf) getHandle().getBukkitEntity(); + return (Wolf) super.getBukkitEntity(); } public static class EntityWolfNPC extends EntityWolf implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java b/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java index 362f9be43..b18108699 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CitizensZombieNPC.java @@ -21,7 +21,7 @@ public class CitizensZombieNPC extends CitizensMobNPC { @Override public Zombie getBukkitEntity() { - return (Zombie) getHandle().getBukkitEntity(); + return (Zombie) super.getBukkitEntity(); } public static class EntityZombieNPC extends EntityZombie implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java index c37e73bfb..26ab517f0 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java @@ -1,6 +1,7 @@ package net.citizensnpcs.npc.entity; import java.io.IOException; +import java.net.Socket; import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; @@ -30,13 +31,14 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder { this.npc = (CitizensNPC) npc; itemInWorldManager.setGameMode(EnumGamemode.SURVIVAL); - EmptySocket socket = new EmptySocket(); + Socket socket = new EmptySocket(); NetworkManager netMgr = new EmptyNetworkManager(socket, "npc mgr", new NetHandler() { @Override public boolean a() { return false; } }, server.E().getPrivate()); + netServerHandler = new EmptyNetHandler(minecraftServer, netMgr, this); netMgr.a(netServerHandler); diff --git a/src/main/java/net/citizensnpcs/trait/text/Text.java b/src/main/java/net/citizensnpcs/trait/text/Text.java index cfa011f88..d38598aea 100644 --- a/src/main/java/net/citizensnpcs/trait/text/Text.java +++ b/src/main/java/net/citizensnpcs/trait/text/Text.java @@ -63,7 +63,7 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve public Editor getEditor(final Player player) { final Conversation conversation = new ConversationFactory(plugin) - .addConversationAbandonedListener(this).withLocalEcho(false).withEscapeSequence("npc text") + .addConversationAbandonedListener(this).withLocalEcho(false).withEscapeSequence("/npc text") .withEscapeSequence("exit").withModality(false).withFirstPrompt(new StartPrompt(this)) .buildConversation(player); return new Editor() {