Package me.efekos.simpler.config
Class JsonConfig
java.lang.Object
me.efekos.simpler.config.JsonConfig
Another type of configuration that can read JSON files.
-
Constructor Summary
ConstructorsConstructorDescriptionJsonConfig(String resourceName, org.bukkit.plugin.java.JavaPlugin plugin) Another type of configuration that can read JSON files. -
Method Summary
Modifier and TypeMethodDescriptiongetBoolean(String path, boolean def) Finds aBooleanfrom the configurationgetCharacter(String path, char def) Finds aCharacterfrom the configurationFinds aDoublefrom the configurationgetInteger(String path, int def) Finds anIntegerfrom the configurationFinds a list from config.Finds aStringfrom the configurationvoidreload()Reloads the config by reading the file again.voidsetup()Loads the default configuration file to your plugin's data folder.
-
Constructor Details
-
JsonConfig
Another type of configuration that can read JSON files.- Parameters:
resourceName- Name of the resource you want to use as this config. Make sure that your resource name ends with `.yml` and you have a resource with the exact same name on your 'resources' folder.plugin- An instance of your plugin.
-
-
Method Details
-
setup
Loads the default configuration file to your plugin's data folder. Recommended to use insideJavaPlugin.onEnable().- Throws:
FileNotFoundException- when you don't have a default config file in your 'resources' folder.
-
getString
Finds aStringfrom the configuration -
getBoolean
Finds aBooleanfrom the configuration -
getCharacter
Finds aCharacterfrom the configuration -
getInteger
Finds anIntegerfrom the configuration -
getDouble
Finds aDoublefrom the configuration -
getList
Finds a list from config. Please note that:- Parameters:
path- Key of the value that you want.- Returns:
- A list if found,
nullotherwise.
-
reload
public void reload()Reloads the config by reading the file again.
-