Class Action
java.lang.Object
ua.mcchickenstudio.opencreative.coding.blocks.actions.Action
- All Implemented Interfaces:
CodingBlock
- Direct Known Subclasses:
Condition, ControlAction, EntityAction, LaunchFunctionAction, LaunchMethodAction, MultiAction, PlayerAction, SelectionAction, VariableAction, WorldAction
Action
This class represents Action that will be executed in executor.- Since:
- 5.0
- Version:
- 6.0
- Author:
- McChicken Studio
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Argumentsprotected org.bukkit.entity.Entityprotected WorldEventprotected ActionsHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidexecute(@Nullable org.bukkit.entity.Entity entity) Executes action with specified entity.abstract @NotNull ActionCategoryReturns category of action, that contains information about action: glass pane materials, block materials.abstract @NotNull ActionTypeReturns type of action, that contains information about action: icon material, arguments list.protected final @NotNull ArgumentsReturns arguments of action.Returns a list of all arguments in this action.protected Set<org.bukkit.entity.Entity> Returns a set of entities whose name or UUID is equal to specified text.org.bukkit.entity.EntityReturns involved entity in action from ActionsHandler.protected @Nullable org.bukkit.entity.EntitygetEntityByNameOrUUID(String text) Returns an entity whose name or UUID is equal to specified text.getEvent()Returns last stored event in action.final ExecutorReturns executor, that stores this action.Returns current ActionsHandler in action.protected Planetprotected Set<org.bukkit.entity.Player> getPlayersByNameOrUUID(String text) Returns enum of target.protected List<org.bukkit.entity.Entity> Returns list of entities that will execute this action.protected org.bukkit.WorldgetWorld()Returns planet's world, where action will be executed.intgetX()Returns X coordinate of coding block's location.intgetY()Returns Y coordinate of coding block's location.intgetZ()Returns Z coordinate of coding block's location.voidprepareAndExecute(@NotNull ActionsHandler handler) Prepares action for executing, sets handler and event, and executes action with target.voidsetEntity(org.bukkit.entity.Entity entity) Sets entity involved in executor's event.voidsetEvent(WorldEvent event) Sets new event.voidsetHandler(ActionsHandler handler) Sets new ActionsHandler.protected voidsetVarValue(@Nullable VariableLink link, Object value) Sets value in local, global or saved variable in world.
-
Field Details
-
arguments
-
entity
protected org.bukkit.entity.Entity entity -
event
-
handler
-
-
Constructor Details
-
Action
Creates an Action with linked executor and specified arguments.- Parameters:
executor- Executor where this action will be added.target- Target, that will execute this action.x- X coordinate from Action's block location in developers planet.args- List of arguments for action.
-
-
Method Details
-
prepareAndExecute
Prepares action for executing, sets handler and event, and executes action with target.- Parameters:
handler- ActionsHandler that stores event data and temporary variables.
-
execute
protected abstract void execute(@Nullable @Nullable org.bukkit.entity.Entity entity) Executes action with specified entity.- Parameters:
entity- Entity to execute action.
-
getActionType
Returns type of action, that contains information about action: icon material, arguments list.- Returns:
- Type of action.
-
getActionCategory
Returns category of action, that contains information about action: glass pane materials, block materials.- Returns:
- Category of action.
-
getArguments
Returns arguments of action.- Returns:
- Arguments of action.
-
getExecutor
Returns executor, that stores this action.- Returns:
- Executor with this action.
-
getEntitiesByNameOrUUID
-
getEntityByNameOrUUID
Returns an entity whose name or UUID is equal to specified text.- Parameters:
text- Text to compare world's entities names and UUIDs.- Returns:
- Entity, or null.
-
getPlayersByNameOrUUID
-
getWorld
protected org.bukkit.World getWorld()Returns planet's world, where action will be executed.- Returns:
- Planet's world.
-
getPlanet
-
getEntity
public org.bukkit.entity.Entity getEntity()Returns involved entity in action from ActionsHandler.- Returns:
- Involved entity.
-
setEntity
public void setEntity(org.bukkit.entity.Entity entity) Sets entity involved in executor's event.- Parameters:
entity- New entity.
-
getEvent
Returns last stored event in action.- Returns:
- CreativeEvent, that called executor with this action.
-
setEvent
-
getHandler
Returns current ActionsHandler in action.- Returns:
- Handler of this action.
-
setHandler
Sets new ActionsHandler.- Parameters:
handler- New handler of action.
-
getTarget
-
getTargets
Returns list of entities that will execute this action.- Returns:
- List of entities to execute action.
-
setVarValue
Sets value in local, global or saved variable in world.- Parameters:
link- Link of variable.value- New value.
-
getArgumentsList
-
getX
public int getX()Description copied from interface:CodingBlockReturns X coordinate of coding block's location.- Specified by:
getXin interfaceCodingBlock- Returns:
- X coordinate.
-
getY
public int getY()Description copied from interface:CodingBlockReturns Y coordinate of coding block's location.- Specified by:
getYin interfaceCodingBlock- Returns:
- Y coordinate.
-
getZ
public int getZ()Description copied from interface:CodingBlockReturns Z coordinate of coding block's location.- Specified by:
getZin interfaceCodingBlock- Returns:
- Z coordinate.
-