Class Argument
java.lang.Object
me.efekos.simpler.commands.syntax.Argument
- Direct Known Subclasses:
DoubleArgument
,IntegerArgument
,ListArgument
,PlayerArgument
,StringArgument
Used for your custom arguments. Extend this class for any type of argument you want.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGenerates a list of suggestions about this argument.abstract String
Returns a short placeholder to represent this argument.abstract ArgumentPriority
Returns a priority about this argument.abstract ArgumentHandleResult
handleCorrection
(String given) Makes sure that the argument player wrote is valid.toString()
Returns a string representation of thisArgument
.
-
Constructor Details
-
Argument
public Argument()Used for your custom arguments. Extend this class for any type of argument you want.
-
-
Method Details
-
getPlaceHolder
Returns a short placeholder to represent this argument. However,toString()
is more recommended than this method if you want to represent this argument as aString
.- Returns:
- The placeholder of this argument. Placeholder is usually a one-word string that represents what this argument should be. For example:
<player>
argument should be the name of anOfflinePlayer
. We are able to understand this, because that argument's placeholder is "player", meaning we should enter someone's name there.
-
getList
Generates a list of suggestions about this argument.- Parameters:
player
- Player who needs suggestions for this argument.current
- Current string player entered so far.- Returns:
- List of the strings player will see.
-
getPriority
Returns a priority about this argument.- Returns:
- Priority of this argument. You can make your argument an optional or required argument using this.
-
handleCorrection
Makes sure that the argument player wrote is valid.- Parameters:
given
- The string that someone wrote as a value for this argument- Returns:
- Is the given argument valid?
-
toString
Returns a string representation of thisArgument
.
-