Class UberConfiguration

java.lang.Object
me.sciguymjm.uberenchant.api.utils.UberConfiguration

public class UberConfiguration extends Object
Utility class to handle saving and loading UberRecords from config files.
  • Constructor Details

    • UberConfiguration

      public UberConfiguration()
  • Method Details

    • loadFromFile

      public static void loadFromFile(File file)
      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

      public static void loadFromFile(String path)
      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

      public static void loadFromFile(String path, String file)
      Loads UberRecords found in specified Yaml file and path. Usage:
      
       UberConfiguration.loadFromFile(plugin.getDataFolder().getPath(), "MyFile.yml"));
       
      Parameters:
      path - The path to the file
      file - 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

      public 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:
      
       UberConfiguration.saveToEnchantmentsFolder(plugin, "MyFile.yml");
       
      Parameters:
      plugin - The plugin to save records from
      file - The file to save
    • saveToFile

      public static void saveToFile(org.bukkit.plugin.Plugin plugin, String path)
      Saves any UberRecords for the specified plugin to a Yaml file. Usage:
      
       UberConfiguration.saveToFile(plugin, "MyFile.yml");
       
      Parameters:
      plugin - the plugin to save records from
      path - The file to save
      See Also:
    • saveToFile

      public static void saveToFile(org.bukkit.plugin.Plugin plugin, File file)
      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 from
      file - 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 UberEnchantment
      cost - Cost of the enchantment
      multiplier - Cost multiplier
      removal - Cost to remove
      extract - Cost to extract
      anything - Wether it can be used on anything or not
      aliases - List of aliases (Can be empty)
      level_cost - Cost per level map (Can be empty)
    • addRecord

      public static boolean addRecord(UberConfiguration.UberRecord record)
      Adds an UberRecord.
      Parameters:
      record - The record to add
      Returns:
      True if it was added