Class EntityDisguise

Direct Known Subclasses:
FriendlyMobDisguise, PlayerDisguise

public abstract class EntityDisguise extends EntityTransfiguration
Abstract base class for disguise-based entity transfigurations.

Uses the LibsDisguises plugin to transform entities into other entity types. Handles applying and reverting disguises to entities when the spell duration expires.

See Also:
  • Field Details

    • disguiseType

      protected me.libraryaddict.disguise.disguisetypes.DisguiseType disguiseType
      The libDisguises disguise type
    • disguise

      protected me.libraryaddict.disguise.disguisetypes.TargetedDisguise disguise
      The libsDisguises disguise
  • Constructor Details

    • EntityDisguise

      public EntityDisguise(Ollivanders2 plugin)
      Default constructor for use in generating spell text. Do not use to cast the spell.
      Parameters:
      plugin - the Ollivanders2 plugin
    • EntityDisguise

      public EntityDisguise(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Double rightWand)
      Constructor.
      Parameters:
      plugin - a callback to the MC plugin
      player - the player who cast this spell
      rightWand - which wand the player was using
  • Method Details

    • transfigureEntity

      @Nullable protected @Nullable org.bukkit.entity.Entity transfigureEntity(@NotNull @NotNull org.bukkit.entity.Entity entity)
      Transfigure the entity.
      Specified by:
      transfigureEntity in class EntityTransfiguration
      Parameters:
      entity - the entity to transfigure
      Returns:
      the transfigured entity
    • canTransfigure

      protected boolean canTransfigure(@NotNull @NotNull org.bukkit.entity.Entity entity)
      Determine if this entity can be transfigured by this spell.

      Checks if LibsDisguises is enabled for spells that require it, then delegates to parent validation. Entity can be transfigured if:

      • The entity is not already the target type
      • It is not in the blocked list
      • It is in the allowed list, if the allowed list exists
      Overrides:
      canTransfigure in class EntityTransfiguration
      Parameters:
      entity - the entity to check
      Returns:
      true if the entity can be transfigured, false otherwise
    • revert

      public void revert()
      Revert the entity back to their original form.
      Overrides:
      revert in class EntityTransfiguration