Class CommandContext
java.lang.Object
com.sk89q.minecraft.util.commands.CommandContext
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final CommandLocals
protected final String[]
protected final SuggestionContext
-
Constructor Summary
ConstructorDescriptionCommandContext
(String args) CommandContext
(String[] args) CommandContext
(String[] args, Set<Character> valueFlags) CommandContext
(String[] args, Set<Character> valueFlags, boolean allowHangingFlag, CommandLocals locals) Parse the given array of arguments.CommandContext
(String[] args, Set<Character> valueFlags, boolean allowHangingFlag, CommandLocals locals, boolean parseFlags) Parse the given array of arguments.CommandContext
(String args, Set<Character> valueFlags) CommandContext
(String args, Set<Character> valueFlags, boolean allowHangingFlag) -
Method Summary
Modifier and TypeMethodDescriptionint
double
getDouble
(int index) double
getDouble
(int index, double def) getFlag
(char ch) double
getFlagDouble
(char ch) double
getFlagDouble
(char ch, double def) int
getFlagInteger
(char ch) int
getFlagInteger
(char ch, int def) getFlags()
int
getInteger
(int index) int
getInteger
(int index, int def) getJoinedStrings
(int initialIndex) String[]
getPaddedSlice
(int index, int padding) String[]
getParsedPaddedSlice
(int index, int padding) String[]
getParsedSlice
(int index) getRemainingString
(int start) String[]
getSlice
(int index) getString
(int index) getString
(int start, int end) boolean
hasFlag
(char ch) boolean
static String[]
-
Field Details
-
command
-
parsedArgs
-
originalArgIndices
-
originalArgs
-
booleanFlags
-
valueFlags
-
suggestionContext
-
locals
-
-
Constructor Details
-
CommandContext
- Throws:
CommandException
-
CommandContext
- Throws:
CommandException
-
CommandContext
- Throws:
CommandException
-
CommandContext
public CommandContext(String args, Set<Character> valueFlags, boolean allowHangingFlag) throws CommandException - Throws:
CommandException
-
CommandContext
- Throws:
CommandException
-
CommandContext
public CommandContext(String[] args, Set<Character> valueFlags, boolean allowHangingFlag, CommandLocals locals) throws CommandException Parse the given array of arguments.Empty arguments are removed from the list of arguments.
- Parameters:
args
- an array with argumentsvalueFlags
- a set containing all value flags (pass null to disable value flag parsing)allowHangingFlag
- true if hanging flags are allowedlocals
- the locals, null to create empty one- Throws:
CommandException
- thrown on a parsing error
-
CommandContext
public CommandContext(String[] args, Set<Character> valueFlags, boolean allowHangingFlag, CommandLocals locals, boolean parseFlags) throws CommandException Parse the given array of arguments.Empty arguments are removed from the list of arguments.
- Parameters:
args
- an array with argumentsvalueFlags
- a set containing all value flags (pass null to disable value flag parsing)allowHangingFlag
- true if hanging flags are allowedlocals
- the locals, null to create empty oneparseFlags
- where to parse flags- Throws:
CommandException
- thrown on a parsing error
-
-
Method Details
-
split
-
getSuggestionContext
-
getCommand
-
matches
-
getString
-
getString
-
getJoinedStrings
-
getRemainingString
-
getString
-
getInteger
- Throws:
NumberFormatException
-
getInteger
- Throws:
NumberFormatException
-
getDouble
- Throws:
NumberFormatException
-
getDouble
- Throws:
NumberFormatException
-
getSlice
-
getPaddedSlice
-
getParsedSlice
-
getParsedPaddedSlice
-
hasFlag
public boolean hasFlag(char ch) -
getFlags
-
getValueFlags
-
getFlag
-
getFlag
-
getFlagInteger
- Throws:
NumberFormatException
-
getFlagInteger
- Throws:
NumberFormatException
-
getFlagDouble
- Throws:
NumberFormatException
-
getFlagDouble
- Throws:
NumberFormatException
-
argsLength
public int argsLength() -
getLocals
-