The Search API
To submit search requests to Journey, you must first get the SearchApi
:
JourneyApi journey = JourneyApiProvider.get();
SearchApi searching = journey.searching();
From the SearchApi
, you may submit a request for players:
searching.runPlayerDestinationSearch(playerUuid, destination, SearchFlags.of(/* any desired flags */));
Alternatively, you may submit a request for an arbitrary JourneyAgent
.
searching.runDestinationSearch(myAgent, origin, destination, SearchFlags.of(/* any desired flags*/));
A request returns a CompletionStage<SearchResult>
, on which you may set callbacks for when the search completes. These requests may safely be called asynchronously. The stage will always be completed on the main server thread.
By itself, the search doesn't start navigation for any player. Use the Navigation API for this step.
SearchResult
The result of a search contains just two pieces of information:
- the successfulness of the search
- the path itself, if the search was successful
SearchFlags
You may request that Journey alter the behavior of the search by passing in SearchFlags
, which are essentially just key-value objects. Current flag types are: