Skip to content

Commit 1215a7a

Browse files
committed
Fixed empty permission not passing perm check
1 parent 8570eab commit 1215a7a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/me/despical/commandframework/CommandFramework.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private Map.Entry<Command, Map.Entry<Method, Object>> getAssociatedCommand(@NotN
216216

217217
@Override
218218
public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command cmd, @NotNull String label, String[] args) {
219-
Map.Entry<Command, Map.Entry<Method, Object>> entry = this.getAssociatedCommand(cmd.getName(), args);
219+
final Map.Entry<Command, Map.Entry<Method, Object>> entry = this.getAssociatedCommand(cmd.getName(), args);
220220

221221
if (entry == null) {
222222
if (anyMatchConsumer != null) {
@@ -226,9 +226,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
226226
return true;
227227
}
228228

229-
Command command = entry.getKey();
229+
final Command command = entry.getKey();
230+
final String permission = command.permission();
230231

231-
if (!sender.hasPermission(command.permission())) {
232+
if (!permission.isEmpty() && !sender.hasPermission(permission)) {
232233
sender.sendMessage(NO_PERMISSION);
233234
return true;
234235
}

0 commit comments

Comments
 (0)