Class ANIMAGUS_EFFECT


public class ANIMAGUS_EFFECT extends ShapeShiftSuper
Effect that transforms a player into their Animagus animal form.

ANIMAGUS_EFFECT is a permanent transformation that disguises a player as their pre-determined animal form (retrieved from the player's O2Player data). The transformation includes:

  • Visual disguise as the target animal form using LibDisguises
  • Appearance customization based on animal type (colors, variants, special states)
  • Restrictions preventing animal-like behaviors (flight, item interaction, etc.)
  • Age enforcement ensuring the animal appears as an adult

Supported Animal Forms: Cats, Rabbits, Wolves, Horses, Llamas, Pandas, Polar Bears, Creepers, Foxes, Pigs, Sheep, Slimes, Spiders, Shulkers, and Turtles - each with form-specific appearance customization.

Behavior Restrictions: While transformed, the player cannot interact with blocks, toggle flight, pick up items, select items in hotbar, consume items, or drop items. These restrictions prevent behaviors inconsistent with animal form and are enforced through event cancellation.

This effect is permanent and cannot be modified via setPermanent(). Use kill() to revert the player to human form.

See Also:
  • Constructor Details

    • ANIMAGUS_EFFECT

      public ANIMAGUS_EFFECT(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid)
      Constructor for creating an Animagus transformation effect.

      Creates a permanent transformation effect that disguises the player as their pre-determined animal form. The constructor retrieves the animal form and color variant from the target player's O2Player data. If the O2Player cannot be found or the form is null, the effect is killed.

      Parameters:
      plugin - a callback to the MC plugin
      duration - not used - animagus effect is always permanent
      isPermanent - ignored - animagus effect is always permanent
      pid - the unique ID of the player to transform
  • Method Details

    • doCheckEffect

      protected void doCheckEffect()
      Transform the player on first tick if not already transformed.

      This template method defers the actual transformation to the first upkeep() call rather than executing in the constructor. This ensures the player entity is fully initialized before the LibDisguises disguise is applied.

      Specified by:
      doCheckEffect in class ShapeShiftSuper
    • setPermanent

      public void setPermanent(boolean perm)
      Override to prevent external modification of permanent status.

      This effect must remain permanent throughout the player's session. Use kill() to revert the player to human form instead.

      Overrides:
      setPermanent in class O2Effect
      Parameters:
      perm - ignored - effect is always permanent
    • doRemove

      public void doRemove()
      Perform cleanup when this Animagus effect is removed.

      The default implementation does nothing, as animal form cleanup is handled by the LibDisguises removal in the parent ShapeShiftSuper.restore() method.

      Specified by:
      doRemove in class O2Effect