Class Commander

java.lang.Object
me.totalfreedom.command.Commander

public abstract class Commander extends Object
This is the base command class which should be extended when creating a new command. Commands must be annotated with the Info and Permissive annotations in order to be properly registered with the CommandHandler.

One single method can be annotated with the Base annotation to specify that method should be called when the command is executed without any arguments.
You are allowed to have as many methods as you want which are annotated with the Subcommand annotation. These methods will be called when the command is executed with the specified subcommand.
You are also allowed to use multiple Completion annotations per method to define multiple tab completions for a single subcommand. This would be useful in the case where you would like to include specific completion cases, but also support basic String completion cases.
When creating Completion annotations, you only need to register arguments a single time per class. For more information, see Subcommand.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Commander(@NotNull org.bukkit.plugin.java.JavaPlugin plugin)
    Initializes this command object.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Method
    Gets the method which should be called when the command is executed without any arguments.
    @NotNull org.bukkit.plugin.java.JavaPlugin
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Commander

      protected Commander(@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin plugin)
      Initializes this command object. The provided JavaPlugin should be the plugin which contains the command.

      This constructor will automatically register all subcommands and completions for this command. It will also automatically infer all required information from the provided Info and Permissive annotations.

      Parameters:
      plugin - The plugin which contains this command.
  • Method Details

    • getBaseMethod

      @Nullable public @Nullable Method getBaseMethod()
      Gets the method which should be called when the command is executed without any arguments.
      This method will return null if the command does not have a base method.
      Returns:
      The base method for this command, or null if the command does not have a base method.
    • getPlugin

      @NotNull public @NotNull org.bukkit.plugin.java.JavaPlugin getPlugin()
      Returns:
      The plugin which owns this command.