Class SentCommand
java.lang.Object
com.github.cyberryan1.cybercore.spigot.command.sent.SentCommand
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 Summary
ConstructorsConstructorDescriptionSentCommand
(BaseCommand baseCommand, org.bukkit.command.CommandSender sender, String[] args) -
Method Summary
Modifier and TypeMethodDescriptiongetArg
(int index) String[]
getArgs()
double
getDoubleAtArg
(int index) Tries to convert the argument at the provided index to a doubleint
getIntegerAtArg
(int index) Tries to convert the argument at the provided index to an integerorg.bukkit.OfflinePlayer
getOfflinePlayerAtArg
(int index) Tries to convert the argument at the provided index to anOfflinePlayer
org.bukkit.entity.Player
org.bukkit.entity.Player
getPlayerAtArg
(int index) Tries to convert the argument at the provided index to aPlayer
org.bukkit.command.CommandSender
-
Constructor Details
-
SentCommand
-
-
Method Details
-
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
- Returns:
- The arguments that were provided to the command
-
getArg
- 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 anOfflinePlayer
- Parameters:
index
- The index of the argument to convert- Returns:
- The
OfflinePlayer
at the provided index - Throws:
IndexOutOfBoundsException
- If the index is out of boundsClassCastException
- 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 aPlayer
- Parameters:
index
- The index of the argument to convert- Returns:
- The
Player
at the provided index - Throws:
IndexOutOfBoundsException
- If the index is out of boundsClassCastException
- 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 boundsClassCastException
- 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 boundsClassCastException
- If the argument at the provided index isn't a valid double
-