Class UberConfiguration
java.lang.Object
me.sciguymjm.uberenchant.api.utils.UberConfiguration
Utility class to handle saving and loading UberRecords from config files.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Utility record class for ease of adding records -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Adds an UberRecord.static UberConfiguration.UberRecord
getByEnchant
(org.bukkit.enchantments.Enchantment enchantment) Get an UberRecord by a specified enchantment.static void
Loads all UberRecords in any Yaml files found under UberEnchants enchantments folder
(Not meant to be used in other plugins.
Plugins can place their Yaml files there as this is called from UberEnchant itself)static void
loadFromFile
(File file) Loads UberRecords found in specified Yaml file.static void
loadFromFile
(String path) Loads UberRecords found in Yaml file specified by the path.static void
loadFromFile
(String path, String file) Loads UberRecords found in specified Yaml file and path.static void
registerUberRecord
(UberEnchantment enchantment, double cost, double multiplier, double removal, double extract, boolean anything, List<String> aliases, Map<Integer, Double> level_cost) Convenient method to both add an UberRecord and register a specified UberEnchantment.static void
static void
saveToEnchantmentsFolder
(org.bukkit.plugin.Plugin plugin, String file) Saves any UberRecords for the specified plugin to the specified file under UberEnchants enchantments folder
Usage:static void
saveToFile
(org.bukkit.plugin.Plugin plugin, File file) Saves any UberRecords for the specified plugin to a Yaml file.static void
saveToFile
(org.bukkit.plugin.Plugin plugin, String path) Saves any UberRecords for the specified plugin to a Yaml file.
-
Constructor Details
-
UberConfiguration
public UberConfiguration()
-
-
Method Details
-
loadFromFile
Loads UberRecords found in specified Yaml file. Usage:UberConfiguration.loadFromFile(new File(plugin.getDataFolder(), "MyFile.yml"));
- Parameters:
file
- The file to load from- See Also:
-
loadFromFile
Loads UberRecords found in Yaml file specified by the path. Usage:UberConfiguration.loadFromFile(plugin.getDataFolder() + "/MyFile.yml");
- Parameters:
path
- The path to load from- See Also:
-
loadFromFile
Loads UberRecords found in specified Yaml file and path. Usage:UberConfiguration.loadFromFile(plugin.getDataFolder().getPath(), "MyFile.yml"));
- Parameters:
path
- The path to the filefile
- The file- See Also:
-
loadFromEnchantmentsFolder
public static void loadFromEnchantmentsFolder()Loads all UberRecords in any Yaml files found under UberEnchants enchantments folder
(Not meant to be used in other plugins.
Plugins can place their Yaml files there as this is called from UberEnchant itself) -
saveToEnchantmentsFolder
Saves any UberRecords for the specified plugin to the specified file under UberEnchants enchantments folder
Usage:UberConfiguration.saveToEnchantmentsFolder(plugin, "MyFile.yml");
- Parameters:
plugin
- The plugin to save records fromfile
- The file to save
-
saveToFile
Saves any UberRecords for the specified plugin to a Yaml file. Usage:UberConfiguration.saveToFile(plugin, "MyFile.yml");
- Parameters:
plugin
- the plugin to save records frompath
- The file to save- See Also:
-
saveToFile
Saves any UberRecords for the specified plugin to a Yaml file. Usage:UberConfiguration.saveToFile(plugin, new File(plugin.getDataFolder(), "MyFile.yml"));
- Parameters:
plugin
- The plugin to save records fromfile
- The file to save- See Also:
-
reloadAll
public static void reloadAll() -
getByEnchant
public static UberConfiguration.UberRecord getByEnchant(org.bukkit.enchantments.Enchantment enchantment) Get an UberRecord by a specified enchantment.- Parameters:
enchantment
- The enchantment- Returns:
- The associated UberRecord or null
-
registerUberRecord
public static void registerUberRecord(UberEnchantment enchantment, double cost, double multiplier, double removal, double extract, boolean anything, List<String> aliases, Map<Integer, Double> level_cost) Convenient method to both add an UberRecord and register a specified UberEnchantment.- Parameters:
enchantment
- The UberEnchantmentcost
- Cost of the enchantmentmultiplier
- Cost multiplierremoval
- Cost to removeextract
- Cost to extractanything
- Wether it can be used on anything or notaliases
- List of aliases (Can be empty)level_cost
- Cost per level map (Can be empty)
-
addRecord
Adds an UberRecord.- Parameters:
record
- The record to add- Returns:
- True if it was added
-