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
ConstructorsConstructorDescriptionYamlConfig(String resourceName, org.bukkit.plugin.java.JavaPlugin plugin) Can be used as a YamlConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.configuration.file.FileConfigurationget()Returns theFileConfigurationobject of this config.booleangetBoolean(String path, Boolean def) Finds aBooleanfrom the configurationdoubleFinds aDoublefrom the configurationintFinds anIntegerfrom the configurationorg.bukkit.LocationgetLocation(String path) Finds aLocationfrom the configurationorg.bukkit.LocationgetLocation(String path, org.bukkit.Location def) Finds aLocationfrom the configurationFinds aStringfrom the configurationgetStringList(String path) voidreload()Reloads the config by reading the file again.voidsetup()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 theFileConfigurationobject of this config.- Returns:
- The
FileConfigurationitself for cases that you need the original methods.
-
getString
Finds aStringfrom the configuration -
getInt
Finds anIntegerfrom the configuration -
getBoolean
Finds aBooleanfrom the configuration -
getStringList
-
getLocation
Finds aLocationfrom the configuration- Parameters:
path- Path to theLocationyou want.def- DefaultLocationto be returned in case nothing found in path.- Returns:
- Whatever found.
-
getLocation
Finds aLocationfrom the configuration- Parameters:
path- Path to theLocationyou want.- Returns:
- Whatever found.
-
getDouble
Finds aDoublefrom the configuration -
reload
public void reload()Reloads the config by reading the file again.
-