Class HARMONIA_NECTERE_PASSUS

java.lang.Object
net.pottercraft.ollivanders2.stationaryspell.O2StationarySpell
net.pottercraft.ollivanders2.stationaryspell.HARMONIA_NECTERE_PASSUS
All Implemented Interfaces:
Serializable

public class HARMONIA_NECTERE_PASSUS extends O2StationarySpell
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 Details

    • minRadiusConfig

      public static final int minRadiusConfig
      Minimum spell radius (1 block) - cabinet must be exactly at the spell location.
      See Also:
    • maxRadiusConfig

      public static final int maxRadiusConfig
      Maximum spell radius (1 block) - cabinet must be exactly at the spell location.
      See Also:
    • minDurationConfig

      public static final int minDurationConfig
      Minimum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.
      See Also:
    • maxDurationConfig

      public static final int maxDurationConfig
      Maximum spell duration (1000 ticks) - not used, harmonia nectere passus is permanent.
      See Also:
    • cooldown

      public static final int cooldown
      The cooldown between uses
      See Also:
  • Constructor Details

    • HARMONIA_NECTERE_PASSUS

      public HARMONIA_NECTERE_PASSUS(@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
    • 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:
      upkeep in class O2StationarySpell
    • getTwin

      @Nullable public @Nullable HARMONIA_NECTERE_PASSUS 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

      @NotNull public @NotNull Map<String,String> 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

      public void deserializeSpellData(@NotNull @NotNull Map<String,String> spellData)
      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:
      checkSpellDeserialization in class O2StationarySpell
      Returns:
      true if all required data is present, false otherwise