Return a CompletableFuture<Boolean> to allow verification of the success of the teleport
This commit is contained in:
parent
da66a75feb
commit
1d1894883b
|
@ -374,8 +374,8 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void teleportToRandomLocation(Player player, Location origin, int minRange, int maxRange, LocationValidator... validators) {
|
||||
getRandomLocation(player, origin, minRange, maxRange, validators).thenApply(player::teleport);
|
||||
public CompletableFuture<Boolean> teleportToRandomLocation(Player player, Location origin, int minRange, int maxRange, LocationValidator... validators) {
|
||||
return getRandomLocation(player, origin, minRange, maxRange, validators).thenApply(player::teleport);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,8 +47,9 @@ public interface RandomTeleportAPI {
|
|||
* @param minRange the minimum distance a found location has to the center location
|
||||
* @param maxRange the maximum distance a found location has to the center location
|
||||
* @param validators additional LocationValidators to customize validity check of a location
|
||||
* @return a CompletableFuture<Boolean> true if teleport was successful else false
|
||||
*/
|
||||
void teleportToRandomLocation(Player player, Location center, int minRange, int maxRange, LocationValidator... validators) throws ExecutionException, InterruptedException;
|
||||
CompletableFuture<Boolean> teleportToRandomLocation(Player player, Location center, int minRange, int maxRange, LocationValidator... validators) throws ExecutionException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Creates a RandomSearcher instance with the passed parameters
|
||||
|
|
Loading…
Reference in New Issue