Class XPrisonEnchantmentBase

java.lang.Object
dev.drawethree.xprison.api.enchants.model.XPrisonEnchantmentBase
All Implemented Interfaces:
XPrisonEnchantment

public abstract class XPrisonEnchantmentBase extends Object implements XPrisonEnchantment
Abstract base class for all XPrison enchantments. Handles common properties and configuration loading from JSON files.
  • Field Details

    • id

      protected int id
    • rawName

      protected String rawName
    • name

      protected String name
    • nameWithoutColor

      protected String nameWithoutColor
    • enabled

      protected boolean enabled
    • maxLevel

      protected int maxLevel
    • baseCost

      protected long baseCost
    • increaseCost

      protected long increaseCost
    • guiProperties

      protected XPrisonEnchantmentGuiProperties guiProperties
  • Constructor Details

    • XPrisonEnchantmentBase

      public XPrisonEnchantmentBase(File configFile)
      Constructs a new enchantment with the given config file.
      Parameters:
      configFile - The file containing enchantment configuration in JSON format.
  • Method Details

    • load

      public void load()
      Loads the enchantment configuration from the JSON file. Calls abstract loadCustomProperties(JsonObject) for subclass-specific properties.
      Specified by:
      load in interface XPrisonEnchantment
      Throws:
      RuntimeException - if the config fails to load or is invalid
    • loadCustomProperties

      protected abstract void loadCustomProperties(com.google.gson.JsonObject config)
      Loads any subclass-specific properties from the configuration. Must be implemented by subclasses.
      Parameters:
      config - The JSON object for the enchantment config.