Interface ConfigurationAPI
public interface ConfigurationAPI
Contains API for getting and modifying MBedwars configurations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationAPI
get()
Returns the global ConfigurationAPI instance.Gets all config names in the main config file.getDescription
(String name) Get the description of a certain config.Get the object that is currently set for this config@Nullable Class
<?> getValueType
(String name) Returns the data type used for a certian Config.void
saveNow
(ConfigFile file) Saves a config file based on the data currently loaded in memory.void
Updates the config value stored in memory.
-
Method Details
-
getAllNames
Collection<String> getAllNames()Gets all config names in the main config file.- Returns:
- A list of all the configs
-
getDescription
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
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
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 changevalue
- 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
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
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
Returns the global ConfigurationAPI instance.- Returns:
- The global ConfigurationAPI instance
-