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.

This commit is contained in:
fullwall 2021-04-14 19:53:49 +08:00
parent b986c4dcb8
commit e63f0ccede
2 changed files with 9 additions and 10 deletions

View File

@ -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<Waypoint> markers = new EntityMarkers<Waypoint>(EntityType.ITEM_FRAME);
private final EntityMarkers<Waypoint> markers = new EntityMarkers<Waypoint>();
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<Waypoint> 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;
}

View File

@ -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!<br> [[Left click]] to add a new wanderable region using the xrange/yrange box centred at that block.<br> [[Right click]] an existing marker to remove that region.<br> 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=<b>Entered the guided waypoint editor!<br> [[Left click]] to add a waypoint guide, [[right click]] an existing waypoint to remove.<br> [[Sneak]] while left clicking to add a destination waypoint.<br> 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=<b>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!<br> [[Left click]] to add a guide waypoint and [[right click]] to remove an existing waypoint.<br> [[Sneak]] while left clicking to add a destination waypoint.<br> Type [[toggle path]] to toggle showing entities at waypoints.<br> 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=<b>=== <l>Linear Waypoint Editor ===<br> [[Left click]] to add a waypoint, [[right click]] to remove it.<br> You can right click while sneaking to select and remove specific points.<br> Type [[markers]] to hide waypoints,<br> [[triggers]] to enter the trigger editor,<br> [[clear]] to clear all waypoints,<br> [[cycle]] to make NPCs cycle through waypoints instead of looping.