Class Targeter

java.lang.Object
me.deecaad.core.mechanics.targeters.Targeter
All Implemented Interfaces:
InlineSerializer<Targeter>, Serializer<Targeter>, net.kyori.adventure.key.Keyed, org.bukkit.Keyed
Direct Known Subclasses:
RelativeTargeter, ServerPlayersTargeter, SourceTargeter, TargetTargeter, WorldTargeter

public abstract class Targeter extends Object implements InlineSerializer<Targeter>
A targeter returns a list of targets. A target can be a Location, an Entity, or a Player.
  • Constructor Details

    • Targeter

      public Targeter()
      Default constructor for serializers.
  • Method Details

    • getWikiLink

      public String getWikiLink()
      Description copied from interface: Serializer
      Returns a link to the page on the wiki that describes this serializer. This method is called from SerializeData, and is used to help the user find potential solutions to their problem.
      Specified by:
      getWikiLink in interface Serializer<Targeter>
      Returns:
      The nullable link to the wiki.
    • isEye

      public boolean isEye()
    • getOffset

      @Nullable public @Nullable VectorProvider getOffset()
    • isEntity

      public abstract boolean isEntity()
      Returns true if this targeter specifically targets an entity. Entity targeters also target locations by default, but that location will always be the entity's location.

      There is 1 caveat, when getOffset() is non-null, the targeted location will be different from the targeted entity.

      Returns:
      true if this targeter targets entities, not specific locations.
    • getTargets

      @NotNull public final @NotNull Iterator<CastData> getTargets(CastData cast)
      Public method to get every possible target for the mechanic using this targeter. The returned targets will have the offset (getOffset()) already applied.
      Parameters:
      cast - The non-null origin of the cast.
      Returns:
      The list of targets.
    • getTargets0

      protected abstract Iterator<CastData> getTargets0(CastData cast)
    • applyParentArgs

      protected Targeter applyParentArgs(me.deecaad.core.file.SerializeData data, Targeter targeter) throws me.deecaad.core.file.SerializerException
      Throws:
      me.deecaad.core.file.SerializerException