From 13dee3570fe8aa33ba3cb481472a0e902d756e5f Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 12 Oct 2020 21:10:49 +0800 Subject: [PATCH] Add messages for chat waypoint trigger --- .../citizensnpcs/trait/waypoint/LinearWaypointProvider.java | 3 +-- .../trait/waypoint/triggers/ChatTriggerPrompt.java | 2 ++ main/src/main/java/net/citizensnpcs/util/Messages.java | 2 ++ main/src/main/resources/messages_en.properties | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java index 99b1fa69a..446d00db0 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java @@ -280,12 +280,11 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider { clearWaypoints(); } }); - } else if (message.equalsIgnoreCase("toggle path")) { + } else if (message.equalsIgnoreCase("toggle path") || message.equalsIgnoreCase("markers")) { event.setCancelled(true); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { - // we need to spawn entities on the main thread. togglePath(); } }); diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/ChatTriggerPrompt.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/ChatTriggerPrompt.java index bab15ec49..2714bfc37 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/ChatTriggerPrompt.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/triggers/ChatTriggerPrompt.java @@ -23,6 +23,7 @@ public class ChatTriggerPrompt extends StringPrompt implements WaypointTriggerPr if (input.startsWith("radius")) { try { radius = Double.parseDouble(input.split(" ")[1]); + Messaging.sendTr((CommandSender) context.getForWhom(), Messages.CHAT_TRIGGER_RADIUS_SET, radius); } catch (NumberFormatException e) { Messaging.sendErrorTr((CommandSender) context.getForWhom(), Messages.WAYPOINT_TRIGGER_CHAT_INVALID_RADIUS); @@ -36,6 +37,7 @@ public class ChatTriggerPrompt extends StringPrompt implements WaypointTriggerPr return (Prompt) context.getSessionData(WaypointTriggerPrompt.RETURN_PROMPT_KEY); } lines.add(input); + Messaging.sendTr((CommandSender) context.getForWhom(), Messages.CHAT_TRIGGER_MESSAGE_ADDED, input); return this; } diff --git a/main/src/main/java/net/citizensnpcs/util/Messages.java b/main/src/main/java/net/citizensnpcs/util/Messages.java index 7ac294ac2..b9c55ff5d 100644 --- a/main/src/main/java/net/citizensnpcs/util/Messages.java +++ b/main/src/main/java/net/citizensnpcs/util/Messages.java @@ -33,7 +33,9 @@ public class Messages { public static final String CAT_STOPPED_LYING = "citizens.commands.npc.cat.lying-stop"; public static final String CAT_STOPPED_SITTING = "citizens.commands.npc.cat.sitting-stop"; public static final String CAT_TYPE_SET = "citizens.commands.npc.cat.type-set"; + public static final String CHAT_TRIGGER_MESSAGE_ADDED = "citizens.editors.waypoints.triggers.chat.message-added"; public static final String CHAT_TRIGGER_PROMPT = "citizens.editors.waypoints.triggers.chat.prompt"; + public static final String CHAT_TRIGGER_RADIUS_SET = "citizens.editors.waypoints.triggers.chat.radius-set"; public static final String CITIZENS_IMPLEMENTATION_DISABLED = "citizens.changed-implementation"; public static final String CITIZENS_INCOMPATIBLE = "citizens.notifications.incompatible-version"; public static final String CITIZENS_INVALID_COMMAND_CLASS = "citizens.commands.invalid.class"; diff --git a/main/src/main/resources/messages_en.properties b/main/src/main/resources/messages_en.properties index ce71c960a..b2b1efd41 100644 --- a/main/src/main/resources/messages_en.properties +++ b/main/src/main/resources/messages_en.properties @@ -247,7 +247,7 @@ citizens.commands.npc.zombiemod.villager-profession-set=[[{0}]]''s profession se citizens.commands.page-missing=The page [[{0}]] does not exist. citizens.commands.requirements.disallowed-mobtype=The NPC cannot be the mob type [[{0}]] for that command. citizens.commands.requirements.living-entity=The NPC must be a living entity. -citizens.commands.requirements.missing-permission=You don't have permission to execute that command. +citizens.commands.requirements.missing-permission=You don''t have permission to execute that command. citizens.commands.requirements.missing-required-trait=Missing required trait [[{0}]]. citizens.commands.requirements.must-be-ingame=You must be ingame to use that command. citizens.commands.requirements.must-be-owner=You must be the owner of this NPC to execute that command. @@ -285,7 +285,7 @@ citizens.editors.already-in-editor=You''re already in an editor! citizens.editors.copier.begin=Entered the NPC copier!
Click anywhere to copy the currently selected NPC. citizens.editors.copier.end=Exited the NPC copier. citizens.editors.equipment.all-items-removed=[[{0}]] had all of its items removed. -citizens.editors.equipment.begin=Entered the equipment editor!
[[Right click]] to equip the NPC or [[crouch right click]] to change the item in hand!
Type [[offhand]], [[chestplate]], [[helmet]], etc. in chat to equip specific slots with the item you're holding! +citizens.editors.equipment.begin=Entered the equipment editor!
[[Right click]] to equip the NPC or [[crouch right click]] to change the item in hand!
Type [[offhand]], [[chestplate]], [[helmet]], etc. in chat to equip specific slots with the item you''re holding! citizens.editors.equipment.end=Exited the equipment editor. citizens.editors.equipment.invalid-block=Invalid block! citizens.editors.equipment.saddled-set=[[{0}]] is now saddled. @@ -349,6 +349,8 @@ citizens.editors.waypoints.triggers.animation.prompt=Enter in animations to perf citizens.editors.waypoints.triggers.animation.invalid-animation=Invalid animation [[{0}]]. Valid animations are {1}. citizens.editors.waypoints.triggers.chat.invalid-radius=The radius must be a number. citizens.editors.waypoints.triggers.chat.missing-radius=No radius supplied. +citizens.editors.waypoints.triggers.chat.message-added=Message added: [[{0}]]. +citizens.editors.waypoints.triggers.chat.radius-set=Radius set to [[{0}]] blocks. citizens.editors.waypoints.triggers.chat.prompt=Enter in chat lines to say.
Type in [[radius (radius)]] to set the block radius to broadcast the messages.
Type [[finish]] to finish the chat trigger or [[back]] to return to the previous prompt. citizens.editors.waypoints.triggers.delay.prompt=Enter the delay in [[server ticks]] to use. (20 ticks = 1 second) citizens.editors.waypoints.triggers.main.missing-waypoint=Not editing a waypoint.