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
ConstructorDescriptionJsonConfig
(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 aBoolean
from the configurationgetCharacter
(String path, char def) Finds aCharacter
from the configurationFinds aDouble
from the configurationgetInteger
(String path, int def) Finds anInteger
from the configurationFinds a list from config.Finds aString
from the configurationvoid
reload()
Reloads the config by reading the file again.void
setup()
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 aString
from the configuration -
getBoolean
Finds aBoolean
from the configuration -
getCharacter
Finds aCharacter
from the configuration -
getInteger
Finds anInteger
from the configuration -
getDouble
Finds aDouble
from 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,
null
otherwise.
-
reload
public void reload()Reloads the config by reading the file again.
-