Class SkillContext

java.lang.Object
org.yuemi.mmomechanics.api.skill.context.SkillContext

public final class SkillContext extends Object
Context wrapper passed during skill executions, containing the caster, the trigger, and local variables.
  • Constructor Details

    • SkillContext

      public SkillContext(@NotNull @NotNull Target caster, @NotNull @NotNull Trigger trigger)
      Constructs a SkillContext.
      Parameters:
      caster - the casting entity/location target
      trigger - the trigger event causing this skill run
  • Method Details

    • getCaster

      @NotNull public @NotNull Target getCaster()
      Gets the caster of the skill.
      Returns:
      the caster target
    • getTrigger

      @NotNull public @NotNull Trigger getTrigger()
      Gets the trigger event context of the skill.
      Returns:
      the trigger context
    • setVariable

      public void setVariable(@NotNull @NotNull String name, @Nullable @Nullable Object value)
      Sets a context-local variable.
      Parameters:
      name - the variable name
      value - the variable value, or null to clear it
    • getVariable

      @NotNull public @NotNull Optional<Object> getVariable(@NotNull @NotNull String name)
      Gets a context-local variable.
      Parameters:
      name - the variable name
      Returns:
      an Optional containing the variable value, or empty if not set
    • getVariables

      @NotNull public @NotNull Map<String,Object> getVariables()
      Gets a read-only copy of all context variables.
      Returns:
      a read-only map of variables