Interface ConfigurationAPI


public interface ConfigurationAPI
Contains API for getting and modifying MBedwars configurations.
  • Method Details

    • getAllNames

      Collection<String> getAllNames()
      Gets all config names in the main config file.
      Returns:
      A list of all the configs
    • getDescription

      @Nullable @Nullable List<String> getDescription(String name) throws IllegalArgumentException
      Get the description of a certain config.
      Parameters:
      name - The name of the config value in the config
      Returns:
      The description of the config
      Throws:
      IllegalArgumentException - if the passed config name does not exist in the MBedwars config
    • getValue

      Object getValue(String name) throws IllegalArgumentException
      Get the object that is currently set for this config
      Parameters:
      name - The name of the config value in the config
      Returns:
      The value that is current set
      Throws:
      IllegalArgumentException - if the passed config name does not exist in the MBedwars config
    • setValue

      void setValue(String name, Object value) throws IllegalArgumentException
      Updates the config value stored in memory. This will NOT save the user's config. The value will be reset to the configured value if the plugin is reloaded, or the server is restarted.
      Parameters:
      name - The name of the config you want to change
      value - The new value for that config
      Throws:
      IllegalArgumentException - if the passed config name does not exist in the MBedwars config, or if the object is not the correct data type
    • getValueType

      @Nullable @Nullable Class<?> getValueType(String name) throws IllegalArgumentException
      Returns the data type used for a certian Config.
      Parameters:
      name - the name of the config
      Returns:
      the class (data type) that a config value is stored as
      Throws:
      IllegalArgumentException - if the passed config name does not exist in the MBedwars config
    • saveNow

      void saveNow(ConfigFile file) throws IllegalStateException
      Saves a config file based on the data currently loaded in memory. This method must be called from the main thread.
      Parameters:
      file - the file type that is being re-saved
      Throws:
      IllegalStateException - if this method is run outside the primary thread
    • get

      static ConfigurationAPI get()
      Returns the global ConfigurationAPI instance.
      Returns:
      The global ConfigurationAPI instance