Enum Class O2StationarySpellType

java.lang.Object
java.lang.Enum<O2StationarySpellType>
net.pottercraft.ollivanders2.stationaryspell.O2StationarySpellType
All Implemented Interfaces:
Serializable, Comparable<O2StationarySpellType>, Constable

public enum O2StationarySpellType extends Enum<O2StationarySpellType>
Enumeration of all available stationary spells in Ollivanders2.

Each stationary spell type encapsulates the implementation class and magic level required to cast the spell. Stationary spells are area-of-effect spells that persist in a location and affect players within their radius.

This enum provides utility methods for looking up spells by name, checking if a player is within a spell's radius, and retrieving spell metadata such as class and magic level.

  • Enum Constant Details

  • Method Details

    • values

      public static O2StationarySpellType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static O2StationarySpellType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getClassName

      @NotNull public @NotNull Class<?> getClassName()
      Gets the implementation class for this stationary spell type.
      Returns:
      the Class object representing the implementation of this spell (never null)
    • getLevel

      @NotNull public @NotNull MagicLevel getLevel()
      Gets the magic level required to cast this stationary spell.

      The level is used to determine compatibility with counter-spells and defensive magic. A counter-spell must be of equal or higher level to successfully dispel this spell.

      Returns:
      the magic level of this spell (never null)
    • getStationarySpellTypeFromString

      @Nullable public static @Nullable O2StationarySpellType getStationarySpellTypeFromString(@NotNull @NotNull String name)
      Looks up a stationary spell type by its enum name (case-insensitive).

      The method converts the input string to uppercase and attempts to match it against the enum constant names. For example, "muffliato" or "MUFFLIATO" both resolve to MUFFLIATO. Invalid names gracefully return null without throwing an exception.

      Parameters:
      name - the name of the spell to look up (not null)
      Returns:
      the matching spell type, or null if no spell with that name exists
    • getSpellName

      @NotNull public @NotNull String getSpellName()
      Gets the human-readable name for this spell type.

      Transforms the enum constant name by replacing underscores with spaces and capitalizing the first letter of each word. For example, MUFFLIATO becomes "Muffliato" and PROTEGO_MAXIMA becomes "Protego Maxima".

      Returns:
      the formatted spell name (never null)
    • isPlayerInsideStationarySpell

      public boolean isPlayerInsideStationarySpell(@NotNull @NotNull org.bukkit.entity.Player player)
      Checks whether a player is within the radius of an active stationary spell of this type.

      Retrieves all active stationary spells at the player's current location and checks if any are of this spell type. A player may be affected by multiple spell types simultaneously.

      Parameters:
      player - the player to check (not null)
      Returns:
      true if the player is within the radius of at least one active spell of this type, false otherwise