Class Input
java.lang.Object
de.eldoria.eldoutilities.commands.command.util.Input
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Get the argument as a booleanboolean
Get the argument as a booleandouble
asDouble()
<T extends Enum<T>>
TGet the argument as an enum<T extends Enum<T>>
TGet the argument as an enumint
asInt()
Get the argument as integerlong
asLong()
Get the argument as a material.asMaterial
(boolean stripStrings) Get the argument as a material.Get the argument as a offline playerasPlayer()
Get the argument as a playerasString()
Get the argument as stringasWorld()
Get the argument as a worldstatic Input
-
Method Details
-
of
-
asString
Get the argument as string- Returns:
- argument as string
-
asInt
Get the argument as integer- Returns:
- index as integer
- Throws:
CommandException
- when the argument is not an integerIndexOutOfBoundsException
-
asLong
- Returns:
- index as long
- Throws:
CommandException
- when the argument is not a longIndexOutOfBoundsException
-
asDouble
- Returns:
- index as double
- Throws:
CommandException
- when the argument is not a doubleIndexOutOfBoundsException
-
asBoolean
Get the argument as a boolean- Returns:
- index as boolean
- Throws:
CommandException
- when the argument is not a booleanIndexOutOfBoundsException
-
asBoolean
public boolean asBoolean(String aTrue, String aFalse) throws CommandException, IndexOutOfBoundsException Get the argument as a boolean- Parameters:
aTrue
- value of trueaFalse
- value of false- Returns:
- index as boolean
- Throws:
CommandException
- when the argument is not a booleanIndexOutOfBoundsException
-
asMaterial
Get the argument as a material.This will send a custom message without listing all possible values.
- Returns:
- index as material
- Throws:
CommandException
- when the argument is not a materialIndexOutOfBoundsException
-
asMaterial
@NotNull public @NotNull Material asMaterial(boolean stripStrings) throws CommandException, IndexOutOfBoundsException Get the argument as a material.This will send a custom message without listing all possible values.
- Parameters:
stripStrings
- if true underscores will be removed before checking- Returns:
- index as material
- Throws:
CommandException
- when the argument is not a materialIndexOutOfBoundsException
-
asEnum
@NotNull public <T extends Enum<T>> T asEnum(Class<T> clazz) throws CommandException, IndexOutOfBoundsException Get the argument as an enum- Type Parameters:
T
- type of enum- Parameters:
clazz
- enum clazz to parse- Returns:
- index as enum value
- Throws:
CommandException
- When the string could not be parsed to an enumIndexOutOfBoundsException
-
asEnum
@NotNull public <T extends Enum<T>> T asEnum(Class<T> clazz, boolean stripStrings) throws CommandException, IndexOutOfBoundsException Get the argument as an enum- Type Parameters:
T
- type of enum- Parameters:
clazz
- enum clazz to parsestripStrings
- if true underscores will be removed before checking- Returns:
- index as enum value
- Throws:
CommandException
- When the string could not be parsed to an enumIndexOutOfBoundsException
-
asPlayer
Get the argument as a player- Returns:
- index as player
- Throws:
CommandException
- when no player with this name is onlineIndexOutOfBoundsException
-
asOfflinePlayer
@NotNull public @NotNull OfflinePlayer asOfflinePlayer() throws CommandException, IndexOutOfBoundsExceptionGet the argument as a offline player- Returns:
- index as offline player
- Throws:
CommandException
- when no player with this name was on this server previouslyIndexOutOfBoundsException
-
asWorld
Get the argument as a world- Returns:
- index as world
- Throws:
CommandException
- When the string is not the name of a worldIndexOutOfBoundsException
-