Package me.efekos.simpler.config
Class YamlConfig
java.lang.Object
me.efekos.simpler.config.YamlConfig
Can be used as a YamlConfiguration. Adds some extra features to default configuration.
-
Constructor Summary
ConstructorDescriptionYamlConfig
(String resourceName, org.bukkit.plugin.java.JavaPlugin plugin) Can be used as a YamlConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.configuration.file.FileConfiguration
get()
Returns theFileConfiguration
object of this config.boolean
getBoolean
(String path, Boolean def) Finds aBoolean
from the configurationdouble
Finds aDouble
from the configurationint
Finds anInteger
from the configurationorg.bukkit.Location
getLocation
(String path) Finds aLocation
from the configurationorg.bukkit.Location
getLocation
(String path, org.bukkit.Location def) Finds aLocation
from the configurationFinds aString
from the configurationgetStringList
(String path) void
reload()
Reloads the config by reading the file again.void
setup()
Loads the default configuration file to your plugin's data folder.
-
Constructor Details
-
YamlConfig
Can be used as a YamlConfiguration. Adds some extra features to default configuration.- 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
public void setup()Loads the default configuration file to your plugin's data folder. Recommended to use insideJavaPlugin.onEnable()
. -
get
public org.bukkit.configuration.file.FileConfiguration get()Returns theFileConfiguration
object of this config.- Returns:
- The
FileConfiguration
itself for cases that you need the original methods.
-
getString
Finds aString
from the configuration -
getInt
Finds anInteger
from the configuration -
getBoolean
Finds aBoolean
from the configuration -
getStringList
-
getLocation
Finds aLocation
from the configuration- Parameters:
path
- Path to theLocation
you want.def
- DefaultLocation
to be returned in case nothing found in path.- Returns:
- Whatever found.
-
getLocation
Finds aLocation
from the configuration- Parameters:
path
- Path to theLocation
you want.- Returns:
- Whatever found.
-
getDouble
Finds aDouble
from the configuration -
reload
public void reload()Reloads the config by reading the file again.
-