Tweaks, improvements & cleanup to the RandomTeleportEngine API

This commit is contained in:
William committed 2022-08-29 00:32:09 +01:00
1 parent 5faab57d8e
commit 63f91c2c8e
4 files changed
+99 -36

No files matched your search

@@ -190,12 +190,14 @@ public abstract class BaseHuskHomesAPI {
* @param user The {@link OnlineUser} to teleport
* @param timedTeleport Whether the teleport should be timed or not (requiring a warmup where they must stand still
* for a period of time)
* @param rtpArgs Arguments that will be passed to the implementing {@link RandomTeleportEngine}
* @return A {@link CompletableFuture} that will complete with a {@link TeleportResult} indicating the result of
* completing the teleport. If the teleport was successful, the {@link TeleportResult#successful} will be {@code true}.
* @since 3.0
*/
public final CompletableFuture<TeleportResult> randomlyTeleportPlayer(@NotNull OnlineUser user, boolean timedTeleport) {
return CompletableFuture.supplyAsync(() -> plugin.getRandomTeleportEngine().getRandomPosition(user.getPosition())
public final CompletableFuture<TeleportResult> randomlyTeleportPlayer(@NotNull OnlineUser user, boolean timedTeleport,
@NotNull String... rtpArgs) {
return CompletableFuture.supplyAsync(() -> plugin.getRandomTeleportEngine().getRandomPosition(user.getPosition(), rtpArgs)
.thenApply(position -> {
if (position.isPresent()) {
return teleportPlayer(user, position.get(), timedTeleport).join();