Class SkillContext
java.lang.Object
org.yuemi.mmomechanics.api.skill.context.SkillContext
Context wrapper passed during skill executions, containing the caster, the trigger, and local variables.
-
Constructor Summary
ConstructorsConstructorDescriptionSkillContext(@NotNull Target caster, @NotNull Trigger trigger) Constructs a SkillContext. -
Method Summary
Modifier and TypeMethodDescription@NotNull TargetGets the caster of the skill.@NotNull TriggerGets the trigger event context of the skill.getVariable(@NotNull String name) Gets a context-local variable.Gets a read-only copy of all context variables.voidsetVariable(@NotNull String name, @Nullable Object value) Sets a context-local variable.
-
Constructor Details
-
SkillContext
Constructs a SkillContext.- Parameters:
caster- the casting entity/location targettrigger- the trigger event causing this skill run
-
-
Method Details
-
getCaster
Gets the caster of the skill.- Returns:
- the caster target
-
getTrigger
Gets the trigger event context of the skill.- Returns:
- the trigger context
-
setVariable
Sets a context-local variable.- Parameters:
name- the variable namevalue- the variable value, or null to clear it
-
getVariable
Gets a context-local variable.- Parameters:
name- the variable name- Returns:
- an Optional containing the variable value, or empty if not set
-
getVariables
Gets a read-only copy of all context variables.- Returns:
- a read-only map of variables
-