Package me.a8kj.config.file
Class BasicBukkitConfig
- All Implemented Interfaces:
CreatableConfig<String>,CRUDOperations<String>,DeletableConfig<String>,ReadableConfig<String>,UpdatableConfig<String>
- Direct Known Subclasses:
AutoReadBukkitConfig
A standard implementation of
BukkitConfig specifically designed for YAML files.
This class bridges the gap between Bukkit's YamlConfiguration and the Moxie
memory system. It implements the lifecycle hooks from BaseConfig to dispatch
events through the ConfigAPI.
- Since:
- 0.1
- Author:
- a8kj7sea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonPostCreate(ConfigFile<String> config) Dispatches aConfigCreateEventafter the configuration file is successfully created.protected voidonPostDelete(ConfigFile<String> config) Dispatches aConfigDeleteEventafter the configuration file is successfully deleted.read()Creates aConfigOperationto read data from a YAML file into memory.update()Creates aConfigOperationto save the current memory state back to a YAML file.Methods inherited from class me.a8kj.config.file.BaseConfig
create, delete, getReader, getWriter, onPreCreate, onPreDelete
-
Constructor Details
-
BasicBukkitConfig
public BasicBukkitConfig()
-
-
Method Details
-
onPostCreate
Dispatches aConfigCreateEventafter the configuration file is successfully created.- Overrides:
onPostCreatein classBaseConfig<String>- Parameters:
config- The created configuration file instance.
-
onPostDelete
Dispatches aConfigDeleteEventafter the configuration file is successfully deleted.- Overrides:
onPostDeletein classBaseConfig<String>- Parameters:
config- The deleted configuration file instance.
-
read
Creates aConfigOperationto read data from a YAML file into memory.The operation loads the
YamlConfigurationfrom disk and populates the memory buffer with non-section keys.- Specified by:
readin interfaceReadableConfig<String>- Specified by:
readin classBaseConfig<String>- Returns:
- a
ConfigOperationfor reading YAML data.
-
update
Creates aConfigOperationto save the current memory state back to a YAML file.This operation synchronizes the
MapPairedDataMemorystorage with aYamlConfigurationinstance before saving to disk.- Specified by:
updatein interfaceUpdatableConfig<String>- Specified by:
updatein classBaseConfig<String>- Returns:
- a
ConfigOperationfor updating YAML disk storage.
-