Class CommandLineActor

java.lang.Object
revxrsal.commands.cli.core.CommandLineActor
All Implemented Interfaces:
Closeable, AutoCloseable, ConsoleActor, CommandActor

public final class CommandLineActor extends Object implements ConsoleActor
  • Constructor Details

    • CommandLineActor

      public CommandLineActor(CLIHandler handler)
  • Method Details

    • getInputStream

      @NotNull public @NotNull InputStream getInputStream()
      Description copied from interface: ConsoleActor
      Returns the InputStream that is being used to take input from the console.
      Specified by:
      getInputStream in interface ConsoleActor
      Returns:
      The console's input stream.
    • getOutputStream

      @NotNull public @NotNull PrintStream getOutputStream()
      Description copied from interface: ConsoleActor
      Returns the PrintStream that is being used to send normal output to the console.
      Specified by:
      getOutputStream in interface ConsoleActor
      Returns:
      The console's output stream.
    • getErrorStream

      @NotNull public @NotNull PrintStream getErrorStream()
      Description copied from interface: ConsoleActor
      Returns the PrintStream that is being used to send errors to the console.
      Specified by:
      getErrorStream in interface ConsoleActor
      Returns:
      The console's output stream.
    • getScanner

      @NotNull public @NotNull Scanner getScanner()
      Description copied from interface: ConsoleActor
      Returns the Scanner that is being polled for input.
      Specified by:
      getScanner in interface ConsoleActor
      Returns:
      The console scanner.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getName

      @NotNull public @NotNull String getName()
      Description copied from interface: CommandActor
      Returns the name of this actor. Varies depending on the platform.
      Specified by:
      getName in interface CommandActor
      Returns:
      The actor name
    • getUniqueId

      @NotNull public @NotNull UUID getUniqueId()
      Description copied from interface: CommandActor
      Returns the unique UID of this subject. Varies depending on the platform.

      Although some platforms explicitly have their underlying senders have UUIDs, some platforms may have to generate this UUID based on other available data.

      Specified by:
      getUniqueId in interface CommandActor
      Returns:
      The UUID of this subject.
    • reply

      public void reply(@NotNull @NotNull String message)
      Description copied from interface: CommandActor
      Replies to the sender with the specified message.

      Varies depending on the platform.

      Specified by:
      reply in interface CommandActor
      Parameters:
      message - Message to reply with.
    • error

      public void error(@NotNull @NotNull String message)
      Description copied from interface: CommandActor
      Replies to the sender with the specified message, and marks it as an error depending on the platform.

      Note that, in certain platforms where no "error" mode is available, this may effectively be equivilent to calling CommandActor.reply(String).

      This method should not throw any exceptions.

      Specified by:
      error in interface CommandActor
      Parameters:
      message - Message to reply with
    • getCommandHandler

      public CommandHandler getCommandHandler()
      Description copied from interface: CommandActor
      Returns the command handler that constructed this actor
      Specified by:
      getCommandHandler in interface CommandActor
      Returns:
      The command handler