Class Orphans

java.lang.Object
revxrsal.commands.orphan.Orphans

public final class Orphans extends Object
Represents the entrypoint to creation of OrphanCommands.

Methods path(String), path(String...) have the same exact behavior as Command annotations.

 
 - @Command("foo bar") -> Orphans.path("foo bar")
 - @Command("foo", "bar") -> Orphans.path("foo", "bar")
 - @Command("foo bar", "buzz buff") -> Orphans.path("foo bar", "buzz buff")
 
 
Registering OrphanCommands directly into a CommandHandler.register(Object...) will throw an exception. Orphan commands should be wrapped using this class as follows:
 
 commandHandler.register(Orphans.path("foo").handler(new Foo()));
 
 
See Also:
  • Constructor Details

    • Orphans

      public Orphans()
  • Method Details

    • path

      public static Orphans path(@NotNull @NotNull String path)
      Starts the registration of an orphan command. The input for this method has exactly the same behavior as Command.

      - @Command("foo bar") -> Orphans.path("foo bar")

      Parameters:
      path - The command path. This accepts spaces for commands with subcategories.
      Returns:
      A builder Orphans. You must call handler(OrphanCommand) after.
    • path

      public static Orphans path(@NotNull @NotNull String... paths)
      Starts the registration of an orphan command. The input for this method has exactly the same behavior as Command.

      - @Command("foo", "bar") -> Orphans.path("foo", "bar")

      Parameters:
      paths - The command paths. These accept spaces for commands with subcategories.
      Returns:
      A builder Orphans. You must call handler(OrphanCommand) after.
    • path

      public static Orphans path(@NotNull @NotNull CommandPath path)
      Starts the registration of an orphan command.
      Parameters:
      path - The command path. See CommandPath.
      Returns:
      A builder Orphans. You must call handler(OrphanCommand) after.
    • handler

      public OrphanRegistry handler(OrphanCommand handler)
      Sets the handler of this orphan command. This can be any class, however it must implement OrphanCommand.
      Parameters:
      handler - The command class logic.
      Returns:
      An OrphanRegistry that can be passed to CommandHandler.register(Object...) to be registered.