This commit is contained in:
Jeremy Schroeder 2012-12-26 12:45:44 -05:00
parent fc7571ec3a
commit 16923ae00b
2 changed files with 11 additions and 10 deletions

View File

@ -964,7 +964,7 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "speak message to speak --type vocalChordType ",
usage = "speak message to speak --target npcid|player_name --type vocal_type",
desc = "Uses the NPCs SpeechController to talk",
modifiers = { "speak" },
min = 1,
@ -978,7 +978,6 @@ public class NPCCommands {
Messaging.send(sender, "Default Vocal Chord for " + npc.getName() + ": " + npc.getTrait(Speech.class).getDefaultVocalChord());
return;
}
Messaging.send(sender, "TEST: " + args.getJoinedStrings(1));
SpeechContext context = new SpeechContext(args.getJoinedStrings(1));
if (args.hasValueFlag("target")) {

View File

@ -20,11 +20,19 @@ public class Chat implements VocalChord {
public final String VOCAL_CHORD_NAME = "chat";
@Override
public String getName() {
return VOCAL_CHORD_NAME;
}
@Override
public void talk(SpeechContext context) {
// Check valid talker
if (context.getTalker() == null) return;
NPC npc = CitizensAPI.getNPCRegistry().getNPC(context.getTalker().getEntity());
if (npc == null) return;
// If no recipients, chat to the world with CHAT_FORMAT and CHAT_RANGE settings
if (!context.hasRecipients()) {
String text = Setting.CHAT_FORMAT.asString().replace("<npc>", npc.getName()).replace("<text>", context.getMessage());
@ -87,7 +95,6 @@ public class Chat implements VocalChord {
String bystanderText = Setting.CHAT_FORMAT_WITH_TARGETS_TO_BYSTANDERS.asString().replace("<npc>", npc.getName()).replace("<targets>", targets).replace("<text>", context.getMessage());
talkToBystanders(npc, bystanderText, context);
}
}
@ -107,9 +114,4 @@ public class Chat implements VocalChord {
}
}
@Override
public String getName() {
return VOCAL_CHORD_NAME;
}
}