Class EventValues
java.lang.Object
ua.mcchickenstudio.opencreative.coding.values.EventValues
EventValues
This class represents registry of event values, that can register new event values for coding.
To get instance use getInstance().
To add custom event value create a class, that
extends one of prepared: TextEventValue,
NumberEventValue, VectorEventValue,
LocationEventValue, ItemEventValue,
BooleanEventValue, and register it with
registerEventValue(EventValue) method.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexists(@NotNull Class<? extends EventValue> clazz) Checks if event value with specified class exists in registry.booleanChecks if event value with specified ID exists in registry.@NotNull List<EventValue> getByCategories(@NotNull MenusCategory menusCategory) Returns list of event values, that have same menu category.@Nullable EventValuegetByClass(@NotNull Class<? extends EventValue> clazz) Returns event value from registry by specified class if it exists, otherwise will return null.@Nullable EventValueReturns event value from registry by specified id if it exists, otherwise will return null.@NotNull List<MenusCategory> Returns list of all menu categories of all event values.@NotNull List<EventValue> Returns a copy of list that contains all registered event values.static @NotNull EventValuesReturns instance of event values controller class.@Nullable ObjectgetValue(@NotNull Class<? extends EventValue> clazz, @NotNull ActionsHandler handler, @NotNull Action action, @NotNull org.bukkit.entity.Entity entity) Returns replaced value of event value if it exists, otherwise it will return null.@Nullable ObjectgetValue(@NotNull String id, @NotNull ActionsHandler handler, @NotNull Action action, @Nullable org.bukkit.entity.Entity entity) Returns replaced value of event value if it exists, otherwise it will return null.voidregisterEventValue(@NotNull EventValue value) Registers event value, that will be replaced in coding.voidregisterEventValue(@NotNull EventValue... values) Registers event values, that will be replaced in coding.voidunregisterEventValue(@NotNull EventValue value) Unregisters event value if list contains it.
-
Constructor Details
-
EventValues
public EventValues()
-
-
Method Details
-
getInstance
Returns instance of event values controller class.- Returns:
- instance of event values.
-
registerEventValue
Registers event value, that will be replaced in coding.- Parameters:
value- event value to register.
-
registerEventValue
Registers event values, that will be replaced in coding.- Parameters:
values- event values to register.
-
unregisterEventValue
Unregisters event value if list contains it.- Parameters:
value- event value to unregister.
-
getEventValues
Returns a copy of list that contains all registered event values.- Returns:
- event values list.
-
getCategories
Returns list of all menu categories of all event values.- Returns:
- list of menu categories.
-
exists
Checks if event value with specified ID exists in registry.- Parameters:
id- id of event value.- Returns:
- true - exists, false - not exists.
-
exists
Checks if event value with specified class exists in registry.- Parameters:
clazz- class of event value.- Returns:
- true - exists, false - not exists.
-
getByClass
@Nullable public @Nullable EventValue getByClass(@NotNull @NotNull Class<? extends EventValue> clazz) Returns event value from registry by specified class if it exists, otherwise will return null.- Parameters:
clazz- class to get event value.- Returns:
- event value - if exists, or null - not exists.
-
getById
Returns event value from registry by specified id if it exists, otherwise will return null.- Parameters:
id- id to get event value.- Returns:
- event value - if exists, or null - not exists.
-
getValue
@Nullable public @Nullable Object getValue(@NotNull @NotNull String id, @NotNull @NotNull ActionsHandler handler, @NotNull @NotNull Action action, @Nullable @Nullable org.bukkit.entity.Entity entity) Returns replaced value of event value if it exists, otherwise it will return null.Replaced value can also be null by some conditions.
- Parameters:
id- id of event value.handler- handler of action.action- action, where it executes.entity- entity, or null.- Returns:
- value of event value, or null.
-
getValue
@Nullable public @Nullable Object getValue(@NotNull @NotNull Class<? extends EventValue> clazz, @NotNull @NotNull ActionsHandler handler, @NotNull @NotNull Action action, @NotNull @NotNull org.bukkit.entity.Entity entity) Returns replaced value of event value if it exists, otherwise it will return null.Replaced value can also be null by some conditions.
- Parameters:
clazz- class of event value.handler- handler of action.action- action, where it executes.entity- entity, or null.- Returns:
- value of event value, or null.
-