Fix warmup set at 0 not being respected, close #260

This commit is contained in:
William278 committed 2022-11-22 14:48:46 +00:00
1 parent 54b517121b
commit a5ffd223cf
1 file changed
+6 -6
@@ -30,7 +30,7 @@ public class TimedTeleport extends Teleport {
this.plugin = plugin;
this.startLocation = teleporter.getPosition();
this.startHealth = teleporter.getHealth();
this.timeLeft = warmupTime;
this.timeLeft = Math.max(warmupTime, 0);
this.teleporter = teleporter;
}
@@ -47,17 +47,17 @@ public class TimedTeleport extends Teleport {
.thenApply(resultState -> CompletedTeleport.from(resultState, this));
}
// Check if the teleporter can bypass warmup
if (timeLeft == 0 || teleporter.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node)) {
return super.execute();
}
// Check if the teleporter is already warming up to teleport
if (plugin.getCache().currentlyOnWarmup.contains(teleporter.uuid)) {
return CompletableFuture.completedFuture(TeleportResult.FAILED_ALREADY_TELEPORTING)
.thenApply(resultState -> CompletedTeleport.from(resultState, this));
}
// Check if the teleporter can bypass warmup
if (teleporter.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node)) {
return super.execute();
}
// Check economy actions
for (Settings.EconomyAction economyAction : economyActions) {
if (!plugin.validateEconomyCheck(executor, economyAction)) {