Skip to content

Commit

Permalink
Fix error with commands ending in single colon (EssentialsX#4508)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
  • Loading branch information
mdcfe and JRoy authored Sep 1, 2021
1 parent b288696 commit fde6524
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public final void addPlugin(final Plugin plugin) {
return;
}
for (final Map.Entry<String, Command> entry : getPluginCommands(plugin).entrySet()) {
final String commandName = entry.getKey().contains(":") ? entry.getKey().split(":")[1] : entry.getKey();
final String[] commandSplit = entry.getKey().split(":", 2);
final String commandName = commandSplit.length > 1 ? commandSplit[1] : entry.getKey();
final Command command = entry.getValue();

final List<Command> pluginCommands = altcommands.computeIfAbsent(commandName.toLowerCase(Locale.ENGLISH), k -> new ArrayList<>());
Expand Down

0 comments on commit fde6524

Please # to comment.