Skip to content

Commit

Permalink
Better checking default commands
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Sep 6, 2024
1 parent 6f85194 commit 3be2bc2
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void onCommandPreProcess(PlayerCommandPreprocessEvent event) {

for (String plugin : CommandManager.pluginMap.keySet()) {
Map<String, Command> commandMap = CommandManager.pluginMap.get(plugin);
PerWorldPlugins.getInstance().getLogger().warning(plugin);
if (PerWorldUtils.getDisabledWorlds(plugin).contains(event.getPlayer().getWorld().getName())) continue;
if (!commandMap.containsKey(commandString)) continue;

Expand All @@ -62,8 +61,20 @@ public void onCommandPreProcess(PlayerCommandPreprocessEvent event) {
}

for (Command defaultCommand : CommandManager.defaultCommands) {
if (defaultCommand.getName().contains(":" + commandString)) {
possibleCommands.add(defaultCommand.getName());
String[] splitDefaultCommand = defaultCommand.getName().split(":");
if (splitDefaultCommand.length == 0) continue;

String[] splitCommand = commandString.split(":");

if (splitCommand.length == 0) {
if (splitDefaultCommand[1].equals(commandString)) {
possibleCommands.add(defaultCommand.getName());
}
} else {
if (defaultCommand.getName().equals(commandString)) {
possibleCommands.add(defaultCommand.getName());
break;
}
}
}

Expand Down

0 comments on commit 3be2bc2

Please sign in to comment.