From e63f0ccede027063f687e5cc0e15126d85bb171a Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 14 Apr 2021 19:53:49 +0800 Subject: [PATCH] Fix entity markers on guided waypoint editor and make toggle path / clear more lenient. Tweaked some copy on the commands to give a better explanation of the guided waypoint feature. --- .../trait/waypoint/GuidedWaypointProvider.java | 13 ++++++------- main/src/main/resources/messages_en.properties | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/waypoint/GuidedWaypointProvider.java b/main/src/main/java/net/citizensnpcs/trait/waypoint/GuidedWaypointProvider.java index 0ae1fb9e3..472ee6f56 100644 --- a/main/src/main/java/net/citizensnpcs/trait/waypoint/GuidedWaypointProvider.java +++ b/main/src/main/java/net/citizensnpcs/trait/waypoint/GuidedWaypointProvider.java @@ -9,7 +9,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; @@ -87,7 +86,7 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider { } final Player player = (Player) sender; return new WaypointEditor() { - private final EntityMarkers markers = new EntityMarkers(EntityType.ITEM_FRAME); + private final EntityMarkers markers = new EntityMarkers(); private boolean showPath; @Override @@ -120,14 +119,14 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider { @EventHandler(ignoreCancelled = true) public void onPlayerChat(AsyncPlayerChatEvent event) { - if (event.getMessage().equalsIgnoreCase("toggle path")) { + if (event.getMessage().contains("toggle path")) { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { togglePath(); } }); - } else if (event.getMessage().equalsIgnoreCase("clear")) { + } else if (event.getMessage().contains("clear")) { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { @@ -178,9 +177,9 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider { int hashcode = event.getRightClicked().getMetadata("citizens.waypointhashcode").get(0).asInt(); Iterator itr = Iterables.concat(available, helpers).iterator(); while (itr.hasNext()) { - Waypoint next = itr.next(); - if (next.hashCode() == hashcode) { - markers.removeMarker(next); + Waypoint point = itr.next(); + if (point.hashCode() == hashcode) { + markers.removeMarker(point); itr.remove(); break; } diff --git a/main/src/main/resources/messages_en.properties b/main/src/main/resources/messages_en.properties index a0d93e07d..a012a749f 100644 --- a/main/src/main/resources/messages_en.properties +++ b/main/src/main/resources/messages_en.properties @@ -334,9 +334,9 @@ citizens.editors.waypoints.wander.added-region=[[Added]] wanderable region at ({ citizens.editors.waypoints.wander.removed-region=[[Removed]] wanderable region at ({0}) ([[{1}]] remaining). citizens.editors.waypoints.wander.editing-regions=Now editing regions!
[[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.
[[Right click]] an existing marker to remove that region.
Type [[regions]] to stop or simply exit the editor. Regions should be overlapping with each other. citizens.editors.waypoints.guided.end=Exited the guided waypoint editor. -citizens.editors.waypoints.guided.begin=Entered the guided waypoint editor!
[[Left click]] to add a waypoint guide, [[right click]] an existing waypoint to remove.
[[Sneak]] while left clicking to add a destination waypoint.
Type [[toggle path]] to toggle showing entities at waypoints. -citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint. This will guide NPCs to their destination. -citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint. This will be available for NPCs to path to. +citizens.editors.waypoints.guided.begin=Entered the guided waypoint editor! The NPC will randomly walk to a [[destination]] waypoint following the nearest [[guide]] point. For example, try putting guide points on a road and destinations inside houses!
[[Left click]] to add a guide waypoint and [[right click]] to remove an existing waypoint.
[[Sneak]] while left clicking to add a destination waypoint.
Type [[toggle path]] to toggle showing entities at waypoints.
Type [[clear]] to clear all waypoints. +citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint which the NPC will follow on the way to their destination. +citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint which the NPC will randomly pathfind between. citizens.editors.waypoints.guided.already-taken=There is already a waypoint here. citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]] total). citizens.editors.waypoints.linear.begin==== Linear Waypoint Editor ===
[[Left click]] to add a waypoint, [[right click]] to remove it.
You can right click while sneaking to select and remove specific points.
Type [[markers]] to hide waypoints,
[[triggers]] to enter the trigger editor,
[[clear]] to clear all waypoints,
[[cycle]] to make NPCs cycle through waypoints instead of looping.