Skip to content

Commit 3da6daa

Browse files
committed
Remove redundant inspect permission checks
- Let command execution and tab completion proceed without local permission gating - Delete unused `hasCommandPermission` helper in `AbstractInspectCommand`
1 parent a28c846 commit 3da6daa

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/main/java/dev/noah/perplayerkit/commands/inspect/AbstractInspectCommand.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
7474
return true;
7575
}
7676

77-
if (!hasCommandPermission(player, command)) {
78-
BroadcastManager.get().sendComponentMessage(player,
79-
ERROR_PREFIX.append(
80-
mm.deserialize("<red>You don't have permission to use this command.</red>")));
81-
SoundManager.playFailure(player);
82-
return true;
83-
}
84-
8577
if (args.length < 2) {
8678
showUsage(player, usageCommand());
8779
return true;
@@ -150,7 +142,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
150142
@NotNull Command command,
151143
@NotNull String label,
152144
@NotNull String[] args) {
153-
if (!(sender instanceof Player) || !hasCommandPermission(sender, command)) {
145+
if (!(sender instanceof Player)) {
154146
return List.of();
155147
}
156148

@@ -180,11 +172,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
180172
return new ArrayList<>();
181173
}
182174

183-
private boolean hasCommandPermission(@NotNull CommandSender sender, @NotNull Command command) {
184-
String permission = command.getPermission();
185-
return permission == null || permission.isBlank() || sender.hasPermission(permission);
186-
}
187-
188175
private int parseSlot(String slotArg, Player player) {
189176
try {
190177
int slot = Integer.parseInt(slotArg);

0 commit comments

Comments
 (0)