mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Add 'say' option to /npc command and add the NPC id for /npc commands
This commit is contained in:
parent
36cbef81a7
commit
1cdeda5d5d
@ -2399,8 +2399,8 @@ public class NPCCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "speak message to speak --target npcid|player_name --type vocal_type",
|
||||
desc = "Uses the NPCs SpeechController to talk",
|
||||
usage = "speak [message] --target [npcid|player name] (--type vocal_type)",
|
||||
desc = "Says a message from the NPC",
|
||||
modifiers = { "speak" },
|
||||
min = 2,
|
||||
permission = "citizens.npc.speak")
|
||||
|
@ -470,7 +470,15 @@ public class CommandTrait extends Trait {
|
||||
}
|
||||
|
||||
public void run(NPC npc, Player clicker) {
|
||||
String interpolatedCommand = Placeholders.replace(command, clicker, npc);
|
||||
String cmd = command;
|
||||
if (command.startsWith("say")) {
|
||||
cmd = "npc speak " + command.replaceFirst("say", "").trim() + " --target <p>";
|
||||
}
|
||||
if ((command.startsWith("npc") || command.startsWith("waypoints") || command.startsWith("wp"))
|
||||
&& !command.contains("--id <id>")) {
|
||||
cmd += " --id <id>";
|
||||
}
|
||||
String interpolatedCommand = Placeholders.replace(cmd, clicker, npc);
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug(
|
||||
"Running command " + interpolatedCommand + " on NPC " + npc.getId() + " clicker " + clicker);
|
||||
|
Loading…
Reference in New Issue
Block a user