Class PhraseCommandContext
-
- All Implemented Interfaces:
public final class PhraseCommandContext<T extends CommandSender>
The
PhraseCommandContext
class contains information to be used in method calls in run-time with PhraseArgument. It is most often used in executions, suggestions and requirements.
-
-
Field Summary
Fields Modifier and Type Field Description private final CommandContext<T>
globalContext
private final List<String>
arguments
private final T
sender
private final String
phraseInput
private final String
input
-
Constructor Summary
Constructors Constructor Description PhraseCommandContext(CommandContext<T> globalContext, List<String> arguments, T sender, String phraseInput, String input)
-
Method Summary
Modifier and Type Method Description final CommandContext<T>
getGlobalContext()
final List<String>
getArguments()
final T
getSender()
final String
getPhraseInput()
final String
getInput()
final String
getArgument(Integer index)
Gets the word from the index. final String
getArgumentOrNull(Integer index)
Gets the word from the index or returns null if no argument is specified with that index. final <T extends Any> T
getGlobalArgument(String name)
Gets the argument with name from the global CommandContext, in the type as specified by T. final <T extends Any> T
getGlobalArgument(Integer index)
Gets the argument at index from the global CommandContext, in the type as specified by T. final <T extends Any> T
getGlobalArgumentOrNull(String name)
Gets the argument with name from the global CommandContext, in the type as specified by T. final <T extends Any> T
getGlobalArgumentOrNull(Integer index)
Gets the argument at index from the global CommandContext, in the type as specified by T. final String
get(Integer index)
Gets the word from the index. -
-
Constructor Detail
-
PhraseCommandContext
PhraseCommandContext(CommandContext<T> globalContext, List<String> arguments, T sender, String phraseInput, String input)
- Parameters:
globalContext
- The global CommandContext used outside the PhraseArgument.arguments
- A list of words used in PhraseArgument.sender
- This property has the type of whatever you are specified in theCommandContext<T>
generic type.phraseInput
- A String that represents the phrase input.input
- A String that represents the entire command input excluding the/
.
-
-
Method Detail
-
getGlobalContext
final CommandContext<T> getGlobalContext()
-
getArguments
final List<String> getArguments()
-
getPhraseInput
final String getPhraseInput()
-
getArgument
final String getArgument(Integer index)
Gets the word from the index.
-
getArgumentOrNull
final String getArgumentOrNull(Integer index)
-
getGlobalArgument
final <T extends Any> T getGlobalArgument(String name)
Gets the argument with name from the global CommandContext, in the type as specified by T.
- Returns:
The argument with the type of T.
-
getGlobalArgument
final <T extends Any> T getGlobalArgument(Integer index)
Gets the argument at index from the global CommandContext, in the type as specified by T.
- Returns:
The argument with the type of T.
-
getGlobalArgumentOrNull
final <T extends Any> T getGlobalArgumentOrNull(String name)
Gets the argument with name from the global CommandContext, in the type as specified by T.
- Returns:
The argument with the type of T, which returns null if the argument cannot be cast successfully.
-
getGlobalArgumentOrNull
final <T extends Any> T getGlobalArgumentOrNull(Integer index)
Gets the argument at index from the global CommandContext, in the type as specified by T.
- Returns:
The argument with the type of T, which returns null if the argument cannot be cast successfully.
-
-
-
-