diff --git a/bukkit/src/main/java/co/aikar/commands/BukkitRootCommand.java b/bukkit/src/main/java/co/aikar/commands/BukkitRootCommand.java index b25848ee..400c8cb7 100644 --- a/bukkit/src/main/java/co/aikar/commands/BukkitRootCommand.java +++ b/bukkit/src/main/java/co/aikar/commands/BukkitRootCommand.java @@ -23,8 +23,11 @@ package co.aikar.commands; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Syntax; import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; +import jdk.nashorn.internal.ir.ReturnNode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -100,12 +103,32 @@ public class BukkitRootCommand extends Command implements RootCommand { @Override public String getDescription() { final RegisteredCommand cmd = this.getDefaultRegisteredCommand(); - return cmd != null ? cmd.helpText : null; + if (cmd != null) { + return cmd.helpText; + } + BaseCommand defCommand = getDefCommand(); + if (defCommand != null) { + Description descAnno = defCommand.getClass().getAnnotation(Description.class); + if (descAnno != null) { + return descAnno.value(); + } + } + return ""; } @Override public String getUsage() { final RegisteredCommand cmd = this.getDefaultRegisteredCommand(); - return cmd != null ? cmd.syntaxText : null; + if (cmd != null) { + return cmd.syntaxText; + } + BaseCommand defCommand = getDefCommand(); + if (defCommand != null) { + Syntax syntaxAnno = defCommand.getClass().getAnnotation(Syntax.class); + if (syntaxAnno != null) { + return syntaxAnno.value(); + } + } + return ""; } } diff --git a/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html b/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html index 285fc2dc..c0a7b537 100644 --- a/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html +++ b/docs/acf-bukkit/co/aikar/commands/BukkitRootCommand.html @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":18,"i2":18,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10}; +var methods = {"i0":10,"i1":18,"i2":18,"i3":10,"i4":10,"i5":18,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],16:["t5","Default Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -114,7 +114,7 @@ var activeTableTab = "activeTableTab";


  • -
    public class BukkitRootCommand
    +
    public class BukkitRootCommand
     extends org.bukkit.command.Command
  • @@ -176,18 +176,30 @@ extends org.bukkit.command.Command getCommandName()  +default co.aikar.commands.RegisteredCommand +getDefaultRegisteredCommand()  + + co.aikar.commands.BaseCommand getDefCommand()  - + +String +getDescription()  + + co.aikar.commands.CommandManager getManager()  - + com.google.common.collect.SetMultimap<String,co.aikar.commands.RegisteredCommand> getSubCommands()  - + +String +getUsage()  + + List<String> tabComplete(org.bukkit.command.CommandSender sender, String alias, @@ -199,7 +211,7 @@ extends org.bukkit.command.Command

    Methods inherited from class org.bukkit.command.Command

    -broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, toString, unregister +broadcastCommandMessage, broadcastCommandMessage, getAliases, getLabel, getName, getPermission, getPermissionMessage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, testPermission, testPermissionSilent, toString, unregister