Enum Class O2PotionType

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

public enum O2PotionType extends Enum<O2PotionType>
Enumeration of all potion types available in Ollivanders2.

Each potion type defines a distinct magical brew with its display name, implementation class, and magic difficulty level. Potions are brewed by players using cauldrons and specific ingredients, then consumed for various magical effects.

Magic levels range from BEGINNER (simple potions like Cure for Boils) to NEWT (advanced potions like Draught of Living Death).

See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static O2PotionType[] 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 O2PotionType 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()
      Get the implementation class for this potion type.
      Returns:
      the Class object for this potion's implementation (extends O2Potion)
    • getLevel

      @NotNull public @NotNull MagicLevel getLevel()
      Get the magic level of this potion
      Returns:
      the magic level
    • getPotionName

      @NotNull public @NotNull String getPotionName()
      Get the display name for this potion type.
      Returns:
      the human-readable potion name (e.g., "Baruffio's Brain Elixir")
    • getPotionTypeFromString

      @Nullable public static @Nullable O2PotionType getPotionTypeFromString(@NotNull @NotNull String potionString)
      Get an O2PotionType enum from its enum name string.

      This should be used as the opposite of toString() on the enum. This is distinctly different from getPotionTypeByName(String) which gets the potion type by the display name, which may not match enum.toString() (e.g., "Baruffio's Brain Elixir" vs "BARUFFIOS_BRAIN_ELIXIR").

      Parameters:
      potionString - the enum name of the potion type (e.g., "SLEEPING_DRAUGHT", "WIGGENWELD_POTION")
      Returns:
      the potion type if found, null if the string doesn't match any potion type
    • getPotionTypeByName

      @Nullable public static @Nullable O2PotionType getPotionTypeByName(@NotNull @NotNull String name)
      Get a potion type by its display name.

      This is distinctly different from getPotionTypeFromString(String) which gets the potion based on the enum.toString() value. Display names may include punctuation and spaces that aren't valid in enum names (e.g., "Baruffio's Brain Elixir", "Wit-Sharpening Potion").

      The comparison is case-insensitive.

      Parameters:
      name - the display name of the potion to find (e.g., "Sleeping Draught")
      Returns:
      the potion type if found, null if no potion matches the given name