Skip to content

Commit

Permalink
Velocity-Permissions
Browse files Browse the repository at this point in the history
- fixed permission behaviour
  • Loading branch information
Lorias-Jak committed Sep 7, 2023
1 parent 6a67fe5 commit eac7537
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import me.confuser.banmanager.common.BanManagerPlugin;
import me.confuser.banmanager.common.commands.CommonCommand;
import me.confuser.banmanager.common.commands.CommonSender;
import me.confuser.banmanager.common.util.Message;

import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
Expand All @@ -34,6 +35,11 @@ public void execute(final Invocation invocation) {
CommonSender commonSender = getSender(commandSource);
boolean success = false;

if (!commonSender.hasPermission(command.getPermission())) {
commonSender.sendMessage(Message.getString("sender.error.noPermission"));
return;
}

try {
success = this.command.onCommand(commonSender, this.command.getParser(args));
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
Expand Down

0 comments on commit eac7537

Please sign in to comment.