diff --git a/src/main/java/co/aikar/commands/RootCommand.java b/src/main/java/co/aikar/commands/RootCommand.java index 7cb3aac4..4e91aac2 100644 --- a/src/main/java/co/aikar/commands/RootCommand.java +++ b/src/main/java/co/aikar/commands/RootCommand.java @@ -24,6 +24,7 @@ package co.aikar.commands; import org.apache.commons.lang.StringUtils; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -76,7 +77,15 @@ public class RootCommand extends Command { if (this.defCommand == null || command.subCommands.get("__default") != null) { this.defCommand = command; } - command.subCommands.keySet().forEach(key -> this.subCommands.put(key, command)); + command.subCommands.keySet().forEach(key -> { + BaseCommand regged = this.subCommands.get(key); + if (regged != null) { + ACFLog.severe("ACF Error: " + command.getLabel() + " registered subcommand " + key + " - but it is already defined in " + regged.getLabel()); + ACFLog.severe("2 subcommands of the same prefix may not be spread over 2 different classes. Ignoring this."); + return; + } + this.subCommands.put(key, command); + }); this.children.add(command); } }