\ No newline at end of file
diff --git a/.idea/runConfigurations/ACF__Core___Bukkit___Paper_.xml b/.idea/runConfigurations/ACF__Core___Bukkit___Paper_.xml
new file mode 100644
index 00000000..70debe5d
--- /dev/null
+++ b/.idea/runConfigurations/ACF__Core___Bukkit___Paper_.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/java/co/aikar/commands/BaseCommand.java b/core/src/main/java/co/aikar/commands/BaseCommand.java
index 61f6d8b1..308590e6 100644
--- a/core/src/main/java/co/aikar/commands/BaseCommand.java
+++ b/core/src/main/java/co/aikar/commands/BaseCommand.java
@@ -81,6 +81,7 @@ public abstract class BaseCommand {
private ExceptionHandler exceptionHandler = null;
CommandOperationContext lastCommandOperationContext;
+ private String parentSubcommand;
public BaseCommand() {}
public BaseCommand(String cmd) {
@@ -129,6 +130,7 @@ public abstract class BaseCommand {
this.description = this.commandName + " commands";
this.usageMessage = "/" + this.commandName;
+ this.parentSubcommand = getParentSubcommand(this.getClass());
final CommandPermission perm = self.getAnnotation(CommandPermission.class);
if (perm != null) {
@@ -137,16 +139,19 @@ public abstract class BaseCommand {
boolean foundDefault = false;
boolean foundUnknown = false;
+ boolean isParentEmpty = parentSubcommand.isEmpty();
for (Method method : self.getMethods()) {
method.setAccessible(true);
String sublist = null;
String sub = getSubcommandValue(method);
final Default def = method.getAnnotation(Default.class);
final HelpCommand helpCommand = method.getAnnotation(HelpCommand.class);
-
final CommandAlias commandAliases = method.getAnnotation(CommandAlias.class);
- if (def != null || (!foundDefault && helpCommand != null)) {
+ if (!isParentEmpty && def != null) {
+ sub = parentSubcommand;
+ }
+ if (isParentEmpty && (def != null || (!foundDefault && helpCommand != null))) {
if (!foundDefault) {
registerSubcommand(method, DEFAULT);
if (def != null) {
@@ -236,9 +241,13 @@ public abstract class BaseCommand {
if (sub == null) {
return null;
}
- List subList = new ArrayList<>();
- subList.add(sub.value());
Class> clazz = method.getDeclaringClass();
+ String parent = getParentSubcommand(clazz);
+ return parent == null || parent.isEmpty() ? sub.value() : parent + " " + sub.value();
+ }
+
+ private String getParentSubcommand(Class> clazz) {
+ List subList = new ArrayList<>();
while (clazz != null) {
Subcommand classSub = clazz.getAnnotation(Subcommand.class);
if (classSub != null) {