From c2661a7017c7aaa05d6a55647a80cede54964b37 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 21 Sep 2022 20:57:20 +0100 Subject: [PATCH] Fix rtp cooldown not working, close #224 --- .../java/net/william278/huskhomes/command/RtpCommand.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java b/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java index f4737068..50d9acf6 100644 --- a/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java @@ -61,9 +61,8 @@ public class RtpCommand extends CommandBase implements ConsoleExecutable { return; } final Instant currentTime = Instant.now(); - if (!isExecutorTeleporting - && !currentTime.isAfter(userData.get().rtpCooldown()) - && !onlineUser.hasPermission(Permission.BYPASS_RTP_COOLDOWN.node)) { + if (isExecutorTeleporting && !currentTime.isAfter(userData.get().rtpCooldown()) + && !onlineUser.hasPermission(Permission.BYPASS_RTP_COOLDOWN.node)) { plugin.getLocales().getLocale("error_rtp_cooldown", Long.toString(currentTime.until(userData.get().rtpCooldown(), ChronoUnit.MINUTES))) .ifPresent(onlineUser::sendMessage); @@ -83,7 +82,7 @@ public class RtpCommand extends CommandBase implements ConsoleExecutable { : plugin.getTeleportManager().teleport(userToTeleport, position.get()); randomTeleport.thenAccept(result -> { if (isExecutorTeleporting && - result.successful && !onlineUser.hasPermission(Permission.BYPASS_RTP_COOLDOWN.node)) { + result.successful && !onlineUser.hasPermission(Permission.BYPASS_RTP_COOLDOWN.node)) { plugin.getDatabase().updateUserData(new UserData(onlineUser, userData.get().homeSlots(), userData.get().ignoringTeleports(), Instant.now().plus(plugin.getSettings().rtpCooldownLength, ChronoUnit.MINUTES)));