Skip to content

Commit 2a38a65

Browse files
committed
use lowercase for subcommand processing
1 parent 9fecb76 commit 2a38a65

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/cat/nyaa/nyaacore/CommandReceiver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public CommandReceiver(T plugin, LanguageRepository i18n) {
117117
m.setAccessible(true);
118118
subCommands.put(anno.value().toLowerCase(), m);
119119
if (!anno.permission().equals(""))
120-
subCommandPermission.put(anno.value(), anno.permission());
120+
subCommandPermission.put(anno.value().toLowerCase(), anno.permission());
121121
}
122122
}
123123

@@ -176,9 +176,9 @@ public void acceptCommand(CommandSender sender, Arguments cmd) {
176176
subCommand = "help";
177177
}
178178

179-
if (subCommandPermission.containsKey(subCommand)) {
180-
if (!sender.hasPermission(subCommandPermission.get(subCommand))) {
181-
throw new NoPermissionException(subCommandPermission.get(subCommand));
179+
if (subCommandPermission.containsKey(subCommand.toLowerCase())) {
180+
if (!sender.hasPermission(subCommandPermission.get(subCommand.toLowerCase()))) {
181+
throw new NoPermissionException(subCommandPermission.get(subCommand.toLowerCase()));
182182
}
183183
}
184184

@@ -240,8 +240,8 @@ public List<String> acceptTabComplete(CommandSender sender, Arguments args) thro
240240
return subCommandClasses.get(cmd.toLowerCase()).acceptTabComplete(sender, args);
241241
List<String> arr = new ArrayList<>();
242242
for (String s : getSubcommands()) {
243-
if (subCommandPermission.containsKey(s)) {
244-
if (!sender.hasPermission(subCommandPermission.get(s))) {
243+
if (subCommandPermission.containsKey(s.toLowerCase())) {
244+
if (!sender.hasPermission(subCommandPermission.get(s.toLowerCase()))) {
245245
continue;
246246
}
247247
}

0 commit comments

Comments
 (0)