Package dev.twilite.game.navigation
Class Navigation
java.lang.Object
dev.twilite.game.navigation.Navigation
Convenience entry point for server-side path plans.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears the cached current route.static intReturns the real path distance between two coordinates, orInteger.MAX_VALUEwhen no route is available.static CompletableFuture<Integer> distanceAsync(Coord start, Coord destination, boolean includeTransports) Returns the real path distance asynchronously, orInteger.MAX_VALUEwhen no route is available.static URIendpoint()Returns the pathfinder server endpoint used by navigation requests.static booleanexecute(dev.twilite.game.navigation.action.NavigationAction action) Executes a single navigation action.Returns the nearest reachable destination by path distance, or empty when none are reachable.Returns the nearest reachable destination by path distance, or empty when none are reachable.Returns the nearest reachable destination fromstartby path distance.static Optional<dev.twilite.game.navigation.action.NavigationAction> Returns the next action from the local player todestination.static Optional<dev.twilite.game.navigation.action.NavigationAction> Returns the next action fromstarttodestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationAction>> Returns the next action asynchronously from the local player todestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationAction>> Returns the next action asynchronously fromstarttodestination.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan from the local player todestination.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan from the local player todestination.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan fromstarttodestination.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan fromstarttodestination.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan fromstarttodestinationusing custom map padding.static Optional<dev.twilite.game.navigation.action.NavigationPlan> Requests a plan fromstarttodestinationusing custom map padding.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously from the local player todestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously from the local player todestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously fromstarttodestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously fromstarttodestination.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously fromstarttodestinationusing custom map padding.static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> Requests a plan asynchronously fromstarttodestinationusing custom map padding.static booleanReturnstruewhen run is enabled.static intReturns the current run energy percentage.static booleanReturnstruewhen a stamina effect is active.static booleanExecutes the next navigation action towarddestination.static booleanstatic voidtoggleRun(boolean on) Toggles run to the requested state.
-
Constructor Details
-
Navigation
public Navigation()
-
-
Method Details
-
staminaActive
public static boolean staminaActive()Returnstruewhen a stamina effect is active. -
runEnabled
public static boolean runEnabled()Returnstruewhen run is enabled. -
runEnergy
public static int runEnergy()Returns the current run energy percentage. -
toggleRun
public static void toggleRun(boolean on) Toggles run to the requested state. -
plan
Requests a plan from the local player todestination. -
plan
public static Optional<dev.twilite.game.navigation.action.NavigationPlan> plan(Coord destination, boolean includeWilderness) Requests a plan from the local player todestination. -
plan
public static Optional<dev.twilite.game.navigation.action.NavigationPlan> plan(Coord start, Coord destination) Requests a plan fromstarttodestination. -
plan
public static Optional<dev.twilite.game.navigation.action.NavigationPlan> plan(Coord start, Coord destination, boolean includeWilderness) Requests a plan fromstarttodestination. -
plan
public static Optional<dev.twilite.game.navigation.action.NavigationPlan> plan(Coord start, Coord destination, int padding) Requests a plan fromstarttodestinationusing custom map padding. -
plan
public static Optional<dev.twilite.game.navigation.action.NavigationPlan> plan(Coord start, Coord destination, int padding, boolean includeWilderness) Requests a plan fromstarttodestinationusing custom map padding. -
endpoint
Returns the pathfinder server endpoint used by navigation requests. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord destination) Requests a plan asynchronously from the local player todestination. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord destination, boolean includeWilderness) Requests a plan asynchronously from the local player todestination. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord start, Coord destination) Requests a plan asynchronously fromstarttodestination. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord start, Coord destination, boolean includeWilderness) Requests a plan asynchronously fromstarttodestination. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord start, Coord destination, int padding) Requests a plan asynchronously fromstarttodestinationusing custom map padding. -
planAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationPlan>> planAsync(Coord start, Coord destination, int padding, boolean includeWilderness) Requests a plan asynchronously fromstarttodestinationusing custom map padding. -
clearCachedPlan
public static void clearCachedPlan()Clears the cached current route. -
distance
Returns the real path distance between two coordinates, orInteger.MAX_VALUEwhen no route is available. -
nearest
Returns the nearest reachable destination by path distance, or empty when none are reachable. -
nearest
Returns the nearest reachable destination by path distance, or empty when none are reachable. -
nearest
public static Optional<Coord> nearest(Coord start, boolean includeTransports, Coord... destinations) Returns the nearest reachable destination fromstartby path distance. -
distanceAsync
public static CompletableFuture<Integer> distanceAsync(Coord start, Coord destination, boolean includeTransports) Returns the real path distance asynchronously, orInteger.MAX_VALUEwhen no route is available. -
next
Returns the next action from the local player todestination. -
next
public static Optional<dev.twilite.game.navigation.action.NavigationAction> next(Coord start, Coord destination) Returns the next action fromstarttodestination. -
nextAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationAction>> nextAsync(Coord destination) Returns the next action asynchronously from the local player todestination. -
nextAsync
public static CompletableFuture<Optional<dev.twilite.game.navigation.action.NavigationAction>> nextAsync(Coord start, Coord destination) Returns the next action asynchronously fromstarttodestination. -
step
Executes the next navigation action towarddestination.The pathfinder chooses the movement mode from the current game state. If the local player is on a sailing world entity, the request includes boat position, hull, heading, collision, and resistance data, and the server returns sailing actions. Otherwise it returns normal walking or transport actions. This method is therefore the preferred entry point for plugins; callers do not need to choose walking versus sailing themselves.
- Returns:
truewhen a cached action was executed, orfalsewhile a new path is being requested or if no action is available.
-
step
-