Try harder to pause wander goal during editor

This commit is contained in:
fullwall 2023-02-22 01:03:41 +08:00
parent 585df3f696
commit d76841c319
2 changed files with 6 additions and 7 deletions

View File

@ -113,18 +113,14 @@ public class WanderWaypointProvider
@Override
public void begin() {
Messaging.sendTr(sender, Messages.WANDER_WAYPOINTS_BEGIN, pathfind ? "<green>" : "<red>");
if (currentGoal != null) {
currentGoal.pause();
}
setPaused(true);
}
@Override
public void end() {
Messaging.sendTr(sender, Messages.WANDER_WAYPOINTS_END);
editingRegions = false;
if (currentGoal != null) {
currentGoal.unpause();
}
setPaused(false);
markers.destroyMarkers();
}
@ -308,6 +304,9 @@ public class WanderWaypointProvider
if (currentGoal == null) {
currentGoal = WanderGoal.builder(npc).xrange(xrange).yrange(yrange).fallback(this).tree(this).delay(delay)
.worldguardRegion(getWorldGuardRegion()).build();
if (paused) {
currentGoal.pause();
}
}
Iterator<GoalEntry> itr = npc.getDefaultGoalController().iterator();
while (itr.hasNext()) {

View File

@ -379,7 +379,7 @@ citizens.editors.waypoints.wander.editing-regions-stop=Exited the region editor.
citizens.editors.waypoints.wander.worldguard-region-not-found=WorldGuard region not found.
citizens.editors.waypoints.wander.worldguard-region-set=WorldGuard region set to [[{0}]].
citizens.editors.waypoints.wander.range-set=Wander range set to xrange [[{0}]] and yrange [[{1}]].
citizens.editors.waypoints.wander.begin=<aqua>Entered the wander waypoint editor.<br><click:suggest_command:pathfind><hover:show_text:Pathfind>{0}Pathfind</hover></click> | <click:suggest_command:xrange ><hover:show_text:Set the x range in blocks><yellow>x range</hover></click> | <click:suggest_command:yrange ><hover:show_text:Set the y range in blocks><yellow>y range</hover></click> | <click:suggest_command:delay ><hover:show_text:Ticks to wait in between wanders><yellow>delay</hover></click><br><click:suggest_command:regions><yellow>Enter the region editor</click> | <click:suggest_command:worldguardregion ><hover:show_text:Restrict wandering to WorldGuard regions><yellow>region</hover></click>
citizens.editors.waypoints.wander.begin=<aqua>Entered the wander waypoint editor.<br><click:suggest_command:pathfind><hover:show_text:Pathfind>{0}Pathfind</hover></click> | <click:suggest_command:xrange ><hover:show_text:Set the x range in blocks><yellow>x range</hover></click> | <click:suggest_command:yrange ><hover:show_text:Set the y range in blocks><yellow>y range</hover></click> | <click:suggest_command:delay ><hover:show_text:Ticks to wait in between wanders><yellow>delay</hover></click><br><click:suggest_command:regions><yellow>Enter the region editor</click> | <click:suggest_command:worldguardregion ><hover:show_text:Restrict wandering to WorldGuard regions><yellow>WorldGuard region</hover></click>
citizens.editors.waypoints.wander.end=Exited the wander waypoint editor.
citizens.editors.waypoints.wander.delay-set=Delay between wanders set to [[{0}]] ticks.
citizens.editors.waypoints.wander.invalid-delay=Invalid delay specified.