Class HARMONIA_NECTERE_PASSUS
java.lang.Object
net.pottercraft.ollivanders2.stationaryspell.O2StationarySpell
net.pottercraft.ollivanders2.stationaryspell.HARMONIA_NECTERE_PASSUS
- All Implemented Interfaces:
Serializable
A stationary spell that creates a paired teleportation portal (vanishing cabinet).
Harmonia Nectere Passus creates a vanishing cabinet that teleports players to its twin cabinet when they enter. The spell:
- Maintains a paired connection with another vanishing cabinet
- Teleports players between the two cabinets when they move into one
- Includes a cooldown to prevent immediate re-teleportation
- Verifies cabinet structural integrity on each upkeep
- Disables itself if the twin cabinet is destroyed or the structure is compromised
The spell is permanent and persists across server restarts.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe cooldown between usesstatic final intMaximum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.static final intMaximum spell radius (1 block) - cabinet must be exactly at the spell location.static final intMinimum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.static final intMinimum spell radius (1 block) - cabinet must be exactly at the spell location. -
Constructor Summary
ConstructorsConstructorDescriptionHARMONIA_NECTERE_PASSUS(@NotNull Ollivanders2 plugin) Simple constructor used for deserializing saved stationary spells at server start.HARMONIA_NECTERE_PASSUS(@NotNull Ollivanders2 plugin, @NotNull UUID pid, @NotNull org.bukkit.Location location, @NotNull org.bukkit.Location twin) Constructs a new HARMONIA_NECTERE_PASSUS spell (vanishing cabinet). -
Method Summary
Modifier and TypeMethodDescriptionbooleanValidates that the spell was properly deserialized with all required data.voiddeserializeSpellData(@NotNull Map<String, String> spellData) Deserializes the vanishing cabinet's twin location from saved state.@Nullable HARMONIA_NECTERE_PASSUSgetTwin()Get the twin for this cabinet.booleanisUsing(org.bukkit.entity.Player player) Is this cabinet in use by the playerSerializes the vanishing cabinet's twin location for persistence.voidupkeep()Ages the spell and validates cabinet integrity and twin connection.Methods inherited from class net.pottercraft.ollivanders2.stationaryspell.O2StationarySpell
age, age, ageByPercent, 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 (1 block) - cabinet must be exactly at the spell location.- See Also:
-
maxRadiusConfig
public static final int maxRadiusConfigMaximum spell radius (1 block) - cabinet must be exactly at the spell location.- See Also:
-
minDurationConfig
public static final int minDurationConfigMinimum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.- See Also:
-
maxDurationConfig
public static final int maxDurationConfigMaximum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.- See Also:
-
cooldown
public static final int cooldownThe cooldown between uses- See Also:
-
-
Constructor Details
-
HARMONIA_NECTERE_PASSUS
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
-
HARMONIA_NECTERE_PASSUS
public HARMONIA_NECTERE_PASSUS(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull UUID pid, @NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.Location twin) Constructs a new HARMONIA_NECTERE_PASSUS spell (vanishing cabinet).Creates a paired vanishing cabinet at the specified location that connects to another cabinet at the twin location. When players enter this cabinet, they are teleported to the twin cabinet with a cooldown to prevent infinite loops.
- 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 this cabinet (not null)twin- the location of the paired cabinet (not null)
-
-
Method Details
-
upkeep
public void upkeep()Ages the spell and validates cabinet integrity and twin connection.Each tick, verifies:
- The cabinet structure is intact and valid
- The twin cabinet still exists
- Cooldowns for players using the cabinet are properly decremented
If any checks fail, both cabinets are destroyed.
- Specified by:
upkeepin classO2StationarySpell
-
getTwin
Get the twin for this cabinet.- Returns:
- the twin if found, null otherwise
-
isUsing
public boolean isUsing(org.bukkit.entity.Player player) Is this cabinet in use by the player- Parameters:
player- the player to check- Returns:
- true if this player is using this cabinet, false otherwise
-
serializeSpellData
Serializes the vanishing cabinet's twin location for persistence.Saves the location of the paired cabinet so it can be restored on server restart.
- Returns:
- a map containing the serialized twin cabinet location
-
deserializeSpellData
Deserializes the vanishing cabinet's twin location from saved state.Restores the location of the paired cabinet when the spell is loaded on server restart.
- Parameters:
spellData- a map containing the serialized cabinet data
-
checkSpellDeserialization
public boolean checkSpellDeserialization()Validates that the spell was properly deserialized with all required data.Checks that the caster UUID, cabinet location, and twin cabinet location are all present.
- Overrides:
checkSpellDeserializationin classO2StationarySpell- Returns:
- true if all required data is present, false otherwise
-