Class CommandExecuteContext

java.lang.Object
me.efekos.simpler.commands.CommandExecuteContext

public class CommandExecuteContext extends Object
A context class that contains some information about a command execution.
  • Constructor Details

    • CommandExecuteContext

      public CommandExecuteContext(org.bukkit.command.CommandSender sender, List<String> args)
      Creates a new context to use for running CommandExecutives of CommandNodes.
      Parameters:
      sender - Sender that ran this command.
      args - List of the arguments sender gave.
  • Method Details

    • isSenderPlayer

      public boolean isSenderPlayer()
      Checks what sender is, and returns whether the sender is a player or not.
      Returns:
      true if sender is a player.
    • isSenderConsole

      public boolean isSenderConsole()
      Checks what sender is, and returns whether the sender is the console or not.
      Returns:
      true if sender is the console.
    • getSender

      public org.bukkit.command.CommandSender getSender()
      Returns the sender that ran this command.
      Returns:
      Sender of this context.
    • getSenderAsPlayer

      public org.bukkit.entity.Player getSenderAsPlayer()
      Casts the sender to a Player, then returns it. Make sure to use this only when isSenderPlayer() is true.
      Returns:
      Sender of this context as Player.
    • getSenderAsConsole

      public org.bukkit.command.ConsoleCommandSender getSenderAsConsole()
      Casts the sender to a ConsoleCommandSender, then returns it. Make sure to use this only when isSenderConsole() is true.
      Returns:
      Sender of this context as ConsoleCommandSender.
    • getArgs

      public List<String> getArgs()
      Returns a list of the arguments that sender gave. Keep in mind that LabelNodes are filtered out from this list. You'll only get the arguments.
      Returns:
      Argument list of this context.