Jelajahi Sumber

Fix issue with /ptp command

Fixes #1773
TfT_02 11 tahun lalu
induk
melakukan
730f786d5b

+ 1 - 0
Changelog.txt

@@ -28,6 +28,7 @@ Version 1.4.08-dev
  = Fixed bug where party chat broke if the display name contained special characters
  = Fixed bug where `/addlevels all` and `/skillreset all` didn't work
  = Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
+ = Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command
  ! Updated localization files
  ! Changed AxesCritical to CriticalHit in config file
  ! Changed several secondary ability permissions(deprecated versions still exist)

+ 2 - 2
src/main/java/com/gmail/nossr50/commands/party/teleport/PtpAcceptCommand.java

@@ -9,9 +9,9 @@ import org.bukkit.entity.Player;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
 import com.gmail.nossr50.locale.LocaleLoader;
-import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.player.UserManager;
+import com.gmail.nossr50.util.skills.SkillUtils;
 
 public class PtpAcceptCommand implements CommandExecutor {
     @Override
@@ -29,7 +29,7 @@ public class PtpAcceptCommand implements CommandExecutor {
             return true;
         }
 
-        if ((ptpRecord.getTimeout() + Config.getInstance().getPTPCommandTimeout()) * Misc.TIME_CONVERSION_FACTOR < System.currentTimeMillis()) {
+        if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
             ptpRecord.removeRequest();
             player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
             return true;

+ 1 - 1
src/main/resources/locale/locale_en_US.properties

@@ -505,7 +505,7 @@ Commands.ptp.Disabled=Party teleporting [[RED]]disabled
 Commands.ptp.NoRequests=[[RED]]You have no teleport requests at this time
 Commands.ptp.NoWorldPermissions=[[RED]][mcMMO] You do not have permission to teleport to the world {0}.
 Commands.ptp.Request1=[[YELLOW]]{0} [[GREEN]]has requested to teleport to you. 
-Commands.ptp.Request2=[[GREEN]]To teleport, type [[YELLOW]]/ptp accept. [[GREEN]]Request expires in [[RED]]{0} [[GREEN]]seconds.
+Commands.ptp.Request2=[[GREEN]]To teleport, type [[YELLOW]]/ptp accept[[GREEN]]. Request expires in [[RED]]{0} [[GREEN]]seconds.
 Commands.ptp.AcceptAny.Enabled=Party teleport request confirmation [[GREEN]]enabled
 Commands.ptp.AcceptAny.Disabled=Party teleport request confirmation [[RED]]disabled
 Commands.ptp.RequestExpired=[[RED]]Party teleport request has expired!