Class Arguments
java.lang.Object
ua.mcchickenstudio.opencreative.coding.arguments.Arguments
Arguments
This class represents an arguments holder, that stores arguments for actions and conditions.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns list of stored arguments.@NotNull org.bukkit.MaterialgetBlockMaterial(@NotNull String path, @NotNull org.bukkit.Material defaultValue, @NotNull Action action) Returns block material value stored in arguments.booleangetBoolean(@NotNull String path, boolean defaultValue, @NotNull Action action) Returns boolean value stored in arguments.getBooleanList(@NotNull String path, @NotNull Action action) Returns list with booleans stored in arguments.chargetCharacter(@NotNull String path, char defaultValue, @NotNull Action action) Returns character value stored in arguments.@NotNull org.bukkit.ColorReturns color value stored in arguments.@NotNull net.kyori.adventure.text.ComponentgetComponent(@NotNull String path, @NotNull net.kyori.adventure.text.Component defaultValue, @NotNull Action action) Returns component value stored in arguments.final @NotNull List<net.kyori.adventure.text.Component> getComponentList(@NotNull String path, @NotNull Action action) Returns list with components stored in arguments.doubleReturns double value stored in arguments.@NotNull org.bukkit.entity.EntityTypegetEntityType(@NotNull String path, @NotNull org.bukkit.entity.EntityType defaultValue, @NotNull Action action) Returns entity type stored in arguments.floatReturns float value stored in arguments.intReturns integer number value stored in arguments.@NotNull org.bukkit.inventory.ItemStackgetItem(@NotNull String path, @NotNull org.bukkit.inventory.ItemStack defaultValue, @NotNull Action action) Returns item value stored in arguments.final @NotNull List<org.bukkit.inventory.ItemStack> getItemList(@NotNull String path, @NotNull Action action) Returns list with items stored in arguments.final <T> List<T> Returns list with values stored in arguments.@NotNull org.bukkit.LocationgetLocation(@NotNull String path, @NotNull org.bukkit.Location defaultValue, @NotNull Action action) Returns location value stored in arguments.final @NotNull List<org.bukkit.Location> getLocationList(@NotNull String path, @NotNull Action action) Returns list with locations stored in arguments.longReturns long number value stored in arguments.Returns map of values stored in arguments.@NotNull org.bukkit.MaterialgetMaterial(@NotNull String path, @NotNull org.bukkit.Material defaultValue, @NotNull Action action) Returns material value stored in arguments.getNumbersList(@NotNull String path, @NotNull Action action) Returns list with double numbers stored in arguments.@NotNull org.bukkit.ParticlegetParticle(@NotNull String path, @NotNull org.bukkit.Particle defaultValue, @NotNull Action action) Returns particle value stored in arguments.@NotNull StringReturns text value stored in arguments.getTextList(@NotNull String path, @NotNull Action action) Returns list with texts stored in arguments.@NotNull ObjectReturns value stored in arguments.@Nullable VariableLinkgetVariableLink(@NotNull String path, @NotNull Action action) Returns variable link stored in arguments.final @NotNull List<VariableLink> getVarLinksList(@NotNull String path, @NotNull Action action) Returns list with variable links stored in arguments.@NotNull org.bukkit.util.VectorReturns vector value stored in arguments.final voidload(@NotNull org.bukkit.configuration.ConfigurationSection section) Loads arguments from action's arguments section.booleanparseObject(Object object, boolean defaultValue) Parses object into boolean number and returns it, or default value.doubleparseObject(Object object, double defaultValue) Parses object into double number and returns it, or default value.floatparseObject(Object object, float defaultValue) Parses object into float number and returns it, or default value.intparseObject(Object object, int defaultValue) Parses object into integer number and returns it, or default value.longparseObject(Object object, long defaultValue) Parses object into long number and returns it, or default value.final booleanpathExists(@NotNull String path) Checks whether argument exists.voidremoveArgumentValue(@NotNull String... paths) Removes stored argument.voidsetArgumentValue(@NotNull String path, @NotNull ValueType type, @NotNull Object value) Sets argument value by key.net.kyori.adventure.text.ComponenttextToComponent(String text)
-
Constructor Details
-
Arguments
-
-
Method Details
-
load
public final void load(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section) Loads arguments from action's arguments section.- Parameters:
section- arguments section of action.
-
pathExists
Checks whether argument exists.- Parameters:
path- key of argument.- Returns:
- true - exists, false - not.
-
getMap
@NotNull public final @NotNull Map<Object,Object> getMap(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns map of values stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- map of values, or empty map - if not found.
-
getList
Returns list with values stored in arguments.- Type Parameters:
T- class of required values.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with values, or empty list - if not found.
-
getVarLinksList
@NotNull public final @NotNull List<VariableLink> getVarLinksList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with variable links stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with variable links, or empty list - if not found.
-
getBooleanList
@NotNull public final @NotNull List<Boolean> getBooleanList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with booleans stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with booleans, or empty list - if not found.
-
getTextList
@NotNull public final @NotNull List<String> getTextList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with texts stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with texts, or empty list - if not found.
-
getComponentList
@NotNull public final @NotNull List<net.kyori.adventure.text.Component> getComponentList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with components stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with components, or empty list - if not found.
-
getNumbersList
@NotNull public final @NotNull List<Double> getNumbersList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with double numbers stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with doubles, or empty list - if not found.
-
getItemList
@NotNull public final @NotNull List<org.bukkit.inventory.ItemStack> getItemList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with items stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with items, or empty list - if not found.
-
getLocationList
@NotNull public final @NotNull List<org.bukkit.Location> getLocationList(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns list with locations stored in arguments.- Parameters:
path- key of argument.action- action, that will be used for parsing variables.- Returns:
- list with locations, or empty list - if not found.
-
getVariableLink
@Nullable public @Nullable VariableLink getVariableLink(@NotNull @NotNull String path, @NotNull @NotNull Action action) Returns variable link stored in arguments.- Parameters:
path- key of argument, that stores boolean value.action- action, that asks for variable link.- Returns:
- variable link, or null - if not found.
-
getMaterial
@NotNull public @NotNull org.bukkit.Material getMaterial(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.Material defaultValue, @NotNull @NotNull Action action) Returns material value stored in arguments.- Parameters:
path- key of argument, that stores material value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getBlockMaterial
@NotNull public @NotNull org.bukkit.Material getBlockMaterial(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.Material defaultValue, @NotNull @NotNull Action action) Returns block material value stored in arguments.- Parameters:
path- key of argument, that stores block material value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getItem
@NotNull public @NotNull org.bukkit.inventory.ItemStack getItem(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.inventory.ItemStack defaultValue, @NotNull @NotNull Action action) Returns item value stored in arguments.- Parameters:
path- key of argument, that stores item value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getBoolean
public boolean getBoolean(@NotNull @NotNull String path, boolean defaultValue, @NotNull @NotNull Action action) Returns boolean value stored in arguments.- Parameters:
path- key of argument, that stores boolean value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getValue
-
getInt
Returns integer number value stored in arguments.- Parameters:
path- key of argument, that stores integer number value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getLong
public long getLong(@NotNull @NotNull String path, long defaultValue, @NotNull @NotNull Action action) Returns long number value stored in arguments.- Parameters:
path- key of argument, that stores long number value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getColor
@NotNull public @NotNull org.bukkit.Color getColor(@NotNull @NotNull String path, org.bukkit.Color defaultValue, @NotNull @NotNull Action action) Returns color value stored in arguments.- Parameters:
path- key of argument, that stores color value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getFloat
public float getFloat(@NotNull @NotNull String path, float defaultValue, @NotNull @NotNull Action action) Returns float value stored in arguments.- Parameters:
path- key of argument, that stores float value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getDouble
public double getDouble(@NotNull @NotNull String path, double defaultValue, @NotNull @NotNull Action action) Returns double value stored in arguments.- Parameters:
path- key of argument, that stores double value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getText
@NotNull public @NotNull String getText(@NotNull @NotNull String path, @NotNull @NotNull String defaultValue, @NotNull @NotNull Action action) Returns text value stored in arguments.- Parameters:
path- key of argument, that stores text value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getEntityType
@NotNull public @NotNull org.bukkit.entity.EntityType getEntityType(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.entity.EntityType defaultValue, @NotNull @NotNull Action action) Returns entity type stored in arguments.- Parameters:
path- key of argument, that stores entity type value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getComponent
@NotNull public @NotNull net.kyori.adventure.text.Component getComponent(@NotNull @NotNull String path, @NotNull @NotNull net.kyori.adventure.text.Component defaultValue, @NotNull @NotNull Action action) Returns component value stored in arguments.- Parameters:
path- key of argument, that stores component value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
textToComponent
-
getParticle
@NotNull public @NotNull org.bukkit.Particle getParticle(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.Particle defaultValue, @NotNull @NotNull Action action) Returns particle value stored in arguments.- Parameters:
path- key of argument, that stores particle value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getCharacter
public char getCharacter(@NotNull @NotNull String path, char defaultValue, @NotNull @NotNull Action action) Returns character value stored in arguments.- Parameters:
path- key of argument, that stores character value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getLocation
@NotNull public @NotNull org.bukkit.Location getLocation(@NotNull @NotNull String path, @NotNull @NotNull org.bukkit.Location defaultValue, @NotNull @NotNull Action action) Returns location value stored in arguments.- Parameters:
path- key of argument, that stores location value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
getVector
@NotNull public @NotNull org.bukkit.util.Vector getVector(String path, org.bukkit.util.Vector defaultValue, Action action) Returns vector value stored in arguments.- Parameters:
path- key of argument, that stores vector value.defaultValue- default value.action- action, that asks for value.- Returns:
- argument value, or default value - if argument is empty or not found.
-
parseObject
Parses object into integer number and returns it, or default value.- Parameters:
object- object to parse.defaultValue- default value.- Returns:
- parsed integer number from object, or default value.
-
parseObject
Parses object into long number and returns it, or default value.- Parameters:
object- object to parse.defaultValue- default value.- Returns:
- parsed long number from object, or default value.
-
parseObject
Parses object into boolean number and returns it, or default value.- Parameters:
object- object to parse.defaultValue- default value.- Returns:
- parsed boolean number from object, or default value.
-
parseObject
Parses object into float number and returns it, or default value.- Parameters:
object- object to parse.defaultValue- default value.- Returns:
- parsed float number from object, or default value.
-
parseObject
Parses object into double number and returns it, or default value.- Parameters:
object- object to parse.defaultValue- default value.- Returns:
- parsed double number from object, or default value.
-
setArgumentValue
-
removeArgumentValue
Removes stored argument.- Parameters:
paths- keys of arguments.
-
getArgumentList
-