Class XPrisonEnchantmentBase
java.lang.Object
dev.drawethree.xprison.api.enchants.model.XPrisonEnchantmentBase
- All Implemented Interfaces:
XPrisonEnchantment
Abstract base class for all XPrison enchantments.
Handles common properties and configuration loading from JSON files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
protected boolean
protected XPrisonEnchantmentGuiProperties
protected int
protected long
protected int
protected String
protected String
protected String
-
Constructor Summary
ConstructorsConstructorDescriptionXPrisonEnchantmentBase
(File configFile) Constructs a new enchantment with the given config file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
load()
Loads the enchantment configuration from the JSON file.protected abstract void
loadCustomProperties
(com.google.gson.JsonObject config) Loads any subclass-specific properties from the configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.drawethree.xprison.api.enchants.model.XPrisonEnchantment
getAuthor, getBaseCost, getGuiProperties, getId, getIncreaseCost, getMaxLevel, getName, getNameWithoutColor, getRawName, isEnabled, unload
-
Field Details
-
id
protected int id -
rawName
-
name
-
nameWithoutColor
-
enabled
protected boolean enabled -
maxLevel
protected int maxLevel -
baseCost
protected long baseCost -
increaseCost
protected long increaseCost -
guiProperties
-
-
Constructor Details
-
XPrisonEnchantmentBase
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 abstractloadCustomProperties(JsonObject)
for subclass-specific properties.- Specified by:
load
in interfaceXPrisonEnchantment
- 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.
-