diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java b/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java index 489268827..ff6d0c884 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java @@ -14,11 +14,9 @@ import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.util.Messaging; public class Chat implements VocalChord { - public final String VOCAL_CHORD_NAME = "chat"; - @Override public String getName() { - return VOCAL_CHORD_NAME; + return "chat"; } @Override diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/speech/CitizensSpeechFactory.java b/main/src/main/java/net/citizensnpcs/npc/ai/speech/CitizensSpeechFactory.java index cda13cd02..f2166b5fd 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/speech/CitizensSpeechFactory.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/speech/CitizensSpeechFactory.java @@ -5,7 +5,6 @@ import java.util.Map; import java.util.Map.Entry; import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; import com.google.common.base.Preconditions; @@ -14,7 +13,7 @@ import net.citizensnpcs.api.ai.speech.Talkable; import net.citizensnpcs.api.ai.speech.VocalChord; public class CitizensSpeechFactory implements SpeechFactory { - Map> registered = new HashMap>(); + private final Map> registered = new HashMap>(); @Override public VocalChord getVocalChord(Class clazz) { @@ -50,10 +49,11 @@ public class CitizensSpeechFactory implements SpeechFactory { @Override public String getVocalChordName(Class clazz) { // Get the name of a VocalChord class that has been registered - for (Entry> vocalChord : registered.entrySet()) - if (vocalChord.getValue() == clazz) + for (Entry> vocalChord : registered.entrySet()) { + if (vocalChord.getValue() == clazz) { return vocalChord.getKey(); - + } + } return null; } @@ -70,11 +70,6 @@ public class CitizensSpeechFactory implements SpeechFactory { return new TalkableEntity(entity); } - @Override - public Talkable newTalkableEntity(LivingEntity entity) { - return newTalkableEntity((Entity) entity); - } - @Override public void register(Class clazz, String name) { Preconditions.checkNotNull(name, "info cannot be null"); diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/speech/TalkableEntity.java b/main/src/main/java/net/citizensnpcs/npc/ai/speech/TalkableEntity.java index c3043267c..1a10ecf40 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/speech/TalkableEntity.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/speech/TalkableEntity.java @@ -14,7 +14,7 @@ import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.util.Messaging; public class TalkableEntity implements Talkable { - Entity entity; + private final Entity entity; public TalkableEntity(Entity entity) { this.entity = entity; @@ -24,10 +24,6 @@ public class TalkableEntity implements Talkable { entity = npc.getEntity(); } - public TalkableEntity(Player player) { - entity = player; - } - /** * Used to compare a LivingEntity to this TalkableEntity * @@ -66,8 +62,8 @@ public class TalkableEntity implements Talkable { } private void talk(NPC npc, String message) { - if (entity instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(entity)) { - Messaging.sendWithNPC(entity, message, npc); + if (!CitizensAPI.getNPCRegistry().isNPC(entity)) { + Messaging.sendWithNPCColorless(entity, message, npc); } }