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
+3 -2
@@ -254,13 +254,14 @@ public class TeleportManager {
return CompletableFuture.completedFuture(TeleportResult.FAILED_ALREADY_TELEPORTING); return CompletableFuture.completedFuture(TeleportResult.FAILED_ALREADY_TELEPORTING);
} }
final int teleportWarmupTime = plugin.getSettings().teleportWarmupTime;
if (!onlineUser.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node) && teleportWarmupTime > 0) {
// Cancel if the player is already moving // Cancel if the player is already moving
if (onlineUser.isMoving()) { if (onlineUser.isMoving()) {
return CompletableFuture.completedFuture(TeleportResult.FAILED_MOVING); return CompletableFuture.completedFuture(TeleportResult.FAILED_MOVING);
} }
final int teleportWarmupTime = plugin.getSettings().teleportWarmupTime; // Carry out the timed teleport
if (!onlineUser.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node) && teleportWarmupTime > 0) {
final TimedTeleport timedTeleport = new TimedTeleport(onlineUser, position, teleportWarmupTime); final TimedTeleport timedTeleport = new TimedTeleport(onlineUser, position, teleportWarmupTime);
return processTeleportWarmup(timedTeleport).thenApplyAsync(teleport -> { return processTeleportWarmup(timedTeleport).thenApplyAsync(teleport -> {
if (!teleport.cancelled) { if (!teleport.cancelled) {