Class Input
java.lang.Object
de.eldoria.eldoutilities.commands.command.util.Input
-
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the argument as a booleanbooleanGet the argument as a booleandoubleasDouble()<T extends Enum<T>>
TGet the argument as an enum<T extends Enum<T>>
TGet the argument as an enumintasInt()Get the argument as integerlongasLong()@NotNull org.bukkit.MaterialGet the argument as a material.@NotNull org.bukkit.MaterialasMaterial(boolean stripStrings) Get the argument as a material.@NotNull org.bukkit.OfflinePlayerGet the argument as a offline player@NotNull org.bukkit.entity.PlayerasPlayer()Get the argument as a playerasString()Get the argument as string@NotNull org.bukkit.WorldasWorld()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
@NotNull public @NotNull org.bukkit.Material asMaterial() throws CommandException, IndexOutOfBoundsExceptionGet 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 org.bukkit.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
@NotNull public @NotNull org.bukkit.entity.Player asPlayer() throws CommandException, IndexOutOfBoundsExceptionGet the argument as a player- Returns:
- index as player
- Throws:
CommandException- when no player with this name is onlineIndexOutOfBoundsException
-
asOfflinePlayer
@NotNull public @NotNull org.bukkit.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
@NotNull public @NotNull org.bukkit.World asWorld() throws CommandException, IndexOutOfBoundsExceptionGet the argument as a world- Returns:
- index as world
- Throws:
CommandException- When the string is not the name of a worldIndexOutOfBoundsException
-