Class PROTEGO_TOTALUM

All Implemented Interfaces:
Serializable

public class PROTEGO_TOTALUM extends ShieldSpell
A stationary shield spell that creates a protective barrier preventing entities from entering.

Protego Totalum creates an area where:

  • Players cannot move into the protected area from outside
  • Hostile mobs that enter have their AI disabled so they cannot move or attack
  • Creatures cannot spawn inside the protected area
  • Entities already inside the area can move freely, including leaving

Note: There is no EntityMoveEvent in Spigot, so hostile mobs are handled by disabling their AI rather than blocking their movement directly.

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 (40 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_TOTALUM

      public PROTEGO_TOTALUM(@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_TOTALUM

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

      Creates a protective barrier at the specified location with the given radius and duration. The barrier will block players from entering, disable AI on hostile mobs, and prevent creature spawns 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

    • getTrackedAffectedEntities

      public List<org.bukkit.entity.Entity> getTrackedAffectedEntities()
      Gets the entities currently affected by this spell (AI disabled).

      Returns a copy of the affected entities list to prevent external modifications.

      Returns:
      a list of entities with disabled AI (not null, may be empty)
    • upkeep

      public void upkeep()
      Ages the spell and manages hostile mobs inside the protected area.

      Checks for hostile entities inside the spell area and disables their AI so they cannot move or attack. Affected entities are tracked so their AI can be restored when the spell ends.

      Specified by:
      upkeep in class O2StationarySpell
    • serializeSpellData

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

      The spell has no extra data to serialize beyond the base spell properties. Affected entities are not saved because they will be re-detected and re-affected when the server restarts and the spell resumes.

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

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

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

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