Package valorless.valorlessutils.config
Class Config
java.lang.Object
valorless.valorlessutils.config.Config
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Represents a key-value entry for configuration validation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
AddValidationEntry
(String key, Object value) Adds a key-value pair to the validation list.<T extends Number>
voidAddValidationEntry
(String key, Vector2<T> value) Adds a Vector2 entry to the validation list.<T extends Number>
voidAddValidationEntry
(String key, Vector3<T> value) Adds a Vector3 entry to the validation list.Retrieves a generic object from the config.Retrieves a boolean from the config.org.bukkit.configuration.ConfigurationSection
Retrieves aConfigurationSection
from the config.Retrieves a double from the config.GetDoubleList
(String key) Retrieves a list of doubles from the config.GetFile()
Returns the underlyingYamlFile
instance.Deprecated.This method is outdated and will be removed in future versions.Retrieves an integer from the config.GetIntList
(String key) Retrieves a list of integers from the config.org.bukkit.inventory.ItemStack
GetItemStack
(String key) Retrieves anItemStack
from the config.List<?>
Retrieves a generic list from the config.org.bukkit.Material
GetMaterial
(String key) Retrieves aMaterial
from the config.Retrieves a String from the config.GetStringList
(String key) Retrieves a list of strings from the config.GetVector2
(String key) Retrieves aVector2
from the config.GetVector3
(String key) Retrieves aVector3
from the config.Checks if a key exists in the config.void
Reload()
Reloads the configuration file and validates it.void
Saves the configuration file.void
Sets a key-value pair in the config.<T extends Number>
voidSetVector2
(String key, Vector2<T> value) Sets aVector2
value in the config.<T extends Number>
voidSetVector3
(String key, Vector3<T> value) Sets aVector3
value in the config.void
Validate()
Validates the configuration file against the validation list.
-
Constructor Details
-
Config
Constructs a new Config object.If the file does not exist, it will be copied from the plugin's resources.
- Parameters:
plugin
- The JavaPlugin instance.file
- The name of the configuration file.
-
-
Method Details
-
Set
Sets a key-value pair in the config. -
SetVector2
Sets aVector2
value in the config. -
SetVector3
Sets aVector3
value in the config. -
GetString
Retrieves a String from the config. -
GetBool
Retrieves a boolean from the config. -
GetInt
Retrieves an integer from the config. -
GetFloat
Deprecated.This method is outdated and will be removed in future versions.Retrieves a float (double) value from the config. -
GetDouble
Retrieves a double from the config. -
GetVector2
Retrieves aVector2
from the config. -
GetVector3
Retrieves aVector3
from the config. -
GetMaterial
Retrieves aMaterial
from the config. -
Get
Retrieves a generic object from the config. -
GetStringList
Retrieves a list of strings from the config. -
GetIntList
Retrieves a list of integers from the config. -
GetDoubleList
Retrieves a list of doubles from the config. -
GetList
Retrieves a generic list from the config. -
GetItemStack
Retrieves anItemStack
from the config. -
HasKey
Checks if a key exists in the config. -
GetConfigurationSection
Retrieves aConfigurationSection
from the config. -
GetFile
Returns the underlyingYamlFile
instance. -
Reload
public void Reload()Reloads the configuration file and validates it. -
SaveConfig
public void SaveConfig()Saves the configuration file. -
AddValidationEntry
Adds a key-value pair to the validation list. -
AddValidationEntry
Adds a Vector2 entry to the validation list. -
AddValidationEntry
Adds a Vector3 entry to the validation list. -
Validate
public void Validate()Validates the configuration file against the validation list.Adds missing keys with their default values and saves the file if necessary. Logs any added or missing entries.
-