Cast command cooldowns manually

This commit is contained in:
fullwall 2020-04-20 00:54:35 +08:00
parent 341f7b1990
commit 725adb009f
2 changed files with 3 additions and 3 deletions

View File

@ -394,7 +394,7 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "create [name] ((-b,u) --at (x:y:z:world) --type (type) --trait ('trait1, trait2...') --b (behaviours))",
usage = "create [name] ((-b,u) --at [x:y:z:world] --type [type] --trait ['trait1, trait2...'] --b [behaviours])",
desc = "Create a new NPC",
flags = "bu",
modifiers = { "create" },

View File

@ -217,7 +217,7 @@ public class CommandTrait extends Trait {
}
public PlayerNPCCommand(NPCCommand command) {
lastUsed.put(command.command, System.currentTimeMillis() / 1000);
lastUsed.put(command.command, ((Number) (System.currentTimeMillis() / 1000)).longValue());
}
public boolean canUse(Player player, NPCCommand command) {
@ -228,7 +228,7 @@ public class CommandTrait extends Trait {
}
long currentTimeSec = System.currentTimeMillis() / 1000;
if (lastUsed.containsKey(command.command)) {
if (currentTimeSec < lastUsed.get(command.command) + command.cooldown) {
if (currentTimeSec < ((Number) (lastUsed.get(command.command) + command.cooldown)).longValue()) {
return false;
}
lastUsed.remove(command.command);