Fix #timedTeleport returning FAILED_MOVING even if the warmup was bypassed or <=0

This commit is contained in:
William278 committed 2022-09-06 01:03:48 +03:00
1 parent 1c2f1134d2
commit 300a01a2c2
1 file changed
+6 -5
@@ -254,13 +254,14 @@ public class TeleportManager {
return CompletableFuture.completedFuture(TeleportResult.FAILED_ALREADY_TELEPORTING);
}
// Cancel if the player is already moving
if (onlineUser.isMoving()) {
return CompletableFuture.completedFuture(TeleportResult.FAILED_MOVING);
}
final int teleportWarmupTime = plugin.getSettings().teleportWarmupTime;
if (!onlineUser.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node) && teleportWarmupTime > 0) {
// Cancel if the player is already moving
if (onlineUser.isMoving()) {
return CompletableFuture.completedFuture(TeleportResult.FAILED_MOVING);
}
// Carry out the timed teleport
final TimedTeleport timedTeleport = new TimedTeleport(onlineUser, position, teleportWarmupTime);
return processTeleportWarmup(timedTeleport).thenApplyAsync(teleport -> {
if (!teleport.cancelled) {