java.lang.Object
com.github.cyberryan1.cybercore.spigot.command.sent.SentCommand

public class SentCommand extends Object
Used to represent an executed command, with the sender and arguments of the command. Allows for one to easily get the arguments of the executed command into a specified type.
  • Constructor Details

    • SentCommand

      public SentCommand(BaseCommand baseCommand, org.bukkit.command.CommandSender sender, String[] args)
  • Method Details

    • getCommand

      public BaseCommand getCommand()
      Returns:
      The command that was executed
    • getSender

      public org.bukkit.command.CommandSender getSender()
      Returns:
      The CommandSender that executed the command
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Returns:
      The Player who executed the command
      Throws:
      ClassCastException - If the sender isn't a player
    • getArgs

      public String[] getArgs()
      Returns:
      The arguments that were provided to the command
    • getArg

      public String getArg(int index)
      Parameters:
      index - The index of the argument to get
      Returns:
      The argument at the provided index
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds
    • getOfflinePlayerAtArg

      public org.bukkit.OfflinePlayer getOfflinePlayerAtArg(int index)
      Tries to convert the argument at the provided index to an OfflinePlayer
      Parameters:
      index - The index of the argument to convert
      Returns:
      The OfflinePlayer at the provided index
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds
      ClassCastException - If the argument at the provided index isn't a valid username
    • getPlayerAtArg

      public org.bukkit.entity.Player getPlayerAtArg(int index)
      Tries to convert the argument at the provided index to a Player
      Parameters:
      index - The index of the argument to convert
      Returns:
      The Player at the provided index
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds
      ClassCastException - If the argument at the provided index isn't a valid username
    • getIntegerAtArg

      public int getIntegerAtArg(int index)
      Tries to convert the argument at the provided index to an integer
      Parameters:
      index - The index of the argument to convert
      Returns:
      The integer at the provided index
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds
      ClassCastException - If the argument at the provided index isn't a valid integer
    • getDoubleAtArg

      public double getDoubleAtArg(int index)
      Tries to convert the argument at the provided index to a double
      Parameters:
      index - The index of the argument to convert
      Returns:
      The double at the provided index
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds
      ClassCastException - If the argument at the provided index isn't a valid double