Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ public void registerCommand(String string, EssentialsCommand command) {

@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
final String commandName = cmd.getName().toLowerCase(java.util.Locale.ROOT);
for (EssentialsCommand command : this.commands) {
if (command.getSubCommands().contains(cmd.getName().toLowerCase())) {
if (command.getSubCommands().contains(commandName)) {
if ((args.length == 0 || command.isIgnoreParent()) && command.getParent() == null) {
CommandResultType type = processRequirements(command, sender, args);
if (!type.equals(CommandResultType.CONTINUE)) return true;
}
} else if (args.length >= 1 && command.getParent() != null && canExecute(args, cmd.getName().toLowerCase(), command)) {
} else if (args.length >= 1 && command.getParent() != null && canExecute(args, commandName, command)) {
CommandResultType type = processRequirements(command, sender, args);
if (!type.equals(CommandResultType.CONTINUE)) return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/fr/maxlego08/essentials/user/ZUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ public void setCooldownSilent(String key, long expiredAt) {

@Override
public boolean isCooldown(String key) {
return this.cooldowns.containsKey(key) && this.cooldowns.get(key) >= System.currentTimeMillis();
Long cooldown = this.cooldowns.get(key);
return cooldown != null && cooldown >= System.currentTimeMillis();
}

@Override
Expand Down
Loading