Enum Class SpellContext

java.lang.Object
java.lang.Enum<SpellContext>
com.binaris.wizardry.api.content.spell.SpellContext
All Implemented Interfaces:
Serializable, Comparable<SpellContext>, Constable

public enum SpellContext extends Enum<SpellContext>
Enum representing different contexts in which a spell can be used. Each context has a unique identifier key that is used inside these spell data files.

This allows for fine-grained control over where spells can appear or be used, such as in spell books, scrolls, wands, NPC trades, treasure loot, etc.

  • Enum Constant Details

    • BOOK

      public static final SpellContext BOOK
      Whether the spell can appear in spell books (crafted or found)
    • SCROLL

      public static final SpellContext SCROLL
      Whether the spell can appear in spell scrolls
    • WANDS

      public static final SpellContext WANDS
      Whether the spell can be used/bound to wands
    • NPCS

      public static final SpellContext NPCS
      Whether NPCs can cast this spell
    • DISPENSERS

      public static final SpellContext DISPENSERS
      Whether the spell can be cast from dispensers
    • COMMANDS

      public static final SpellContext COMMANDS
      Whether the spell can be cast via commands
    • TREASURE

      public static final SpellContext TREASURE
      Whether the spell can appear in treasure/loot chests
    • TRADES

      public static final SpellContext TRADES
      Whether the spell can appear in villager/NPC trades
    • LOOTING

      public static final SpellContext LOOTING
      Whether the spell can be obtained through looting
  • Method Details

    • values

      public static SpellContext[] 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 SpellContext 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
    • fromKey

      public static SpellContext fromKey(String key)
      Gets a SpellContext from its string key
      Parameters:
      key - The string key
      Returns:
      The corresponding SpellContext, or null if not found
    • createDefaultMap

      public static Map<String,Boolean> createDefaultMap()
      Creates a map with all contexts set to the default value (true)
      Returns:
      A map of all context keys to true
    • getAllKeys

      public static String[] getAllKeys()
      Gets an array of all context keys
      Returns:
      Array of all context key strings
    • isValidKey

      public static boolean isValidKey(String key)
      Checks if a given string is a valid context key
      Parameters:
      key - The key to check
      Returns:
      true if the key corresponds to a valid context
    • getKey

      public String getKey()
      Gets the string key used in spell data files
    • toString

      public String toString()
      Overrides:
      toString in class Enum<SpellContext>