Class PROTEGO_MAXIMA

All Implemented Interfaces:
Serializable

public class PROTEGO_MAXIMA extends ShieldSpell
A stationary shield spell that creates a comprehensive protective barrier over an area.

Protego Maxima is a powerful defensive charm that provides multiple layers of protection:

  • Kills tracked projectiles that enter the protected area
  • Prevents living entities outside the area from targeting players or passive mobs inside
  • Blocks lower-level spell projectiles from crossing into the protected area
  • Allows all spells cast by players inside the area to exit freely
  • Prevents projectiles from hitting players or non-hostile mobs inside the area
  • Allows projectiles to hit hostile mobs inside the area

Note: In the Harry Potter universe, this spell would also repel hostile entities like Dementors, but Spigot does not provide an entity move event for this functionality.

Since:
2.21
See Also:
  • Field Details

    • minRadiusConfig

      public static final int minRadiusConfig
      Minimum spell radius (5 blocks).
      See Also:
    • maxRadiusConfig

      public static final int maxRadiusConfig
      Maximum spell radius (30 blocks).
      See Also:
    • minDurationConfig

      public static final int minDurationConfig
      Minimum spell duration (5 minutes).
      See Also:
    • maxDurationConfig

      public static final int maxDurationConfig
      Maximum spell duration (30 minutes).
      See Also:
  • Constructor Details

    • PROTEGO_MAXIMA

      public PROTEGO_MAXIMA(@NotNull @NotNull Ollivanders2 plugin)
      Simple constructor used for deserializing saved stationary spells at server start. Do not use to cast spell.
      Parameters:
      plugin - a callback to the MC plugin
    • PROTEGO_MAXIMA

      public PROTEGO_MAXIMA(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull UUID pid, @NotNull @NotNull org.bukkit.Location location, int radius, int duration)
      Constructs a new PROTEGO_MAXIMA spell cast by a player.

      Creates a protective shield at the specified location with the given radius and duration. The shield will protect against projectiles, block lower-level spells, and prevent hostile targeting of players and passive mobs inside the protected area.

      Parameters:
      plugin - a callback to the MC plugin (not null)
      pid - the UUID of the player who cast the spell (not null)
      location - the center location of the spell (not null)
      radius - the radius for this spell (will be clamped to min/max values)
      duration - the duration of the spell in ticks (will be clamped to min/max values)
  • Method Details

    • getTrackedProjectiles

      @NotNull public @NotNull List<org.bukkit.entity.Projectile> getTrackedProjectiles()
      Gets the projectiles currently being tracked by this spell.

      Returns a copy of the tracked projectiles list to prevent external modifications.

      Returns:
      a list of projectiles being tracked (not null, may be empty)
    • upkeep

      public void upkeep()
      Ages the spell and kills tracked projectiles that enter the protected area.

      Checks each tracked projectile to see if it has entered the spell area. If so, removes the projectile and creates a non-damaging explosion at that location. Dead or escaped projectiles are removed from the tracking list.

      Specified by:
      upkeep in class O2StationarySpell
    • serializeSpellData

      @NotNull public @NotNull Map<String,String> serializeSpellData()
      Serializes the protego maxima spell data for persistence.

      The protego maxima spell has no extra data to serialize beyond the base spell properties, so this method returns an empty map.

      Returns:
      an empty map (the spell has no custom data to serialize)
    • deserializeSpellData

      public void deserializeSpellData(@NotNull @NotNull Map<String,String> spellData)
      Deserializes protego maxima spell data from saved state.

      The protego maxima spell has no extra data to deserialize, so this method does nothing.

      Parameters:
      spellData - the serialized spell data map (not used)