mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-23 00:21:31 +01:00
Cast command cooldowns manually
This commit is contained in:
parent
341f7b1990
commit
725adb009f
@ -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" },
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user