Class PROTEGO_MAXIMA
- All Implemented Interfaces:
Serializable
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum spell duration (30 minutes).static final intMaximum spell radius (30 blocks).static final intMinimum spell duration (5 minutes).static final intMinimum spell radius (5 blocks). -
Constructor Summary
ConstructorsConstructorDescriptionPROTEGO_MAXIMA(@NotNull Ollivanders2 plugin) Simple constructor used for deserializing saved stationary spells at server start.PROTEGO_MAXIMA(@NotNull Ollivanders2 plugin, @NotNull UUID pid, @NotNull org.bukkit.Location location, int radius, int duration) Constructs a new PROTEGO_MAXIMA spell cast by a player. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeSpellData(@NotNull Map<String, String> spellData) Deserializes protego maxima spell data from saved state.@NotNull List<org.bukkit.entity.Projectile> Gets the projectiles currently being tracked by this spell.Serializes the protego maxima spell data for persistence.voidupkeep()Ages the spell and kills tracked projectiles that enter the protected area.Methods inherited from class net.pottercraft.ollivanders2.stationaryspell.O2StationarySpell
age, age, ageByPercent, checkSpellDeserialization, decreaseRadius, flair, getBlock, getCasterID, getDuration, getLivingEntitiesInsideSpellRadius, getLocation, getMaxDuration, getMaxRadius, getMinDuration, getMinRadius, getPlayersInsideSpellRadius, getRadius, getSpellType, increaseDuration, increaseRadius, isActive, isKilled, isLocationInside, isPermanent, kill, setActive
-
Field Details
-
minRadiusConfig
public static final int minRadiusConfigMinimum spell radius (5 blocks).- See Also:
-
maxRadiusConfig
public static final int maxRadiusConfigMaximum spell radius (30 blocks).- See Also:
-
minDurationConfig
public static final int minDurationConfigMinimum spell duration (5 minutes).- See Also:
-
maxDurationConfig
public static final int maxDurationConfigMaximum spell duration (30 minutes).- See Also:
-
-
Constructor Details
-
PROTEGO_MAXIMA
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
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:
upkeepin classO2StationarySpell
-
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
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)
-