Package dev.cwhead.GravesX.manager
Class ConfigManager
java.lang.Object
dev.cwhead.GravesX.manager.ConfigManager
Self-managed configuration system for GravesX.
Does NOT rely on JavaPlugin's built-in config lifecycle (saveDefaultConfig/reloadConfig/saveConfig). It owns extraction, loading, merging, default injection, versioning, backups, and updates.
It still returns Bukkit's FileConfiguration (YamlConfiguration) so the rest of the codebase can keep using getConfig().getX(...).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.configuration.file.FileConfigurationconfig()Returns the currently loaded merged config (lazy loads if needed).voidExtracts jar defaults to disk if missing.@NotNull File@Nullable org.bukkit.configuration.ConfigurationSectiongetConfigSection(String configKey, @NotNull Grave grave) @Nullable org.bukkit.configuration.ConfigurationSectiongetConfigSection(String configKey, @Nullable List<Grave> graveList) @Nullable org.bukkit.configuration.ConfigurationSectiongetConfigSection(String configKey, @NotNull org.bukkit.entity.Entity entity) @Nullable org.bukkit.configuration.ConfigurationSectiongetConfigSection(String configKey, @NotNull org.bukkit.entity.Entity entity, @Nullable List<String> permissionList) @Nullable org.bukkit.configuration.ConfigurationSectiongetConfigSection(String configKey, @Nullable org.bukkit.entity.EntityType entityType, @Nullable List<String> permissionList) Priority order:settings.permission.<perm>settings.entity.<ENTITYTYPE>settings.default.defaultgetPermissionList(@NotNull org.bukkit.entity.Entity entity) Builds a sorted list of permission keys for a given player, matching config sections.@NotNull Filevoidinit(boolean isDevelopmentBuild) Initializes the configuration system: Extract defaults if missing Optionally update configs if outdated / dev build Load merged config into memoryvoidreload()Reloads configuration from disk (legacy single-file supported; otherwise merges folder mode).voidupdateIfNeeded(boolean isDevelopmentBuild) Checks disk config-version and updates config files if needed, then reloads.
-
Field Details
-
CURRENT_CONFIG_VERSION
public static final int CURRENT_CONFIG_VERSION- See Also:
-
-
Constructor Details
-
ConfigManager
-
-
Method Details
-
init
public void init(boolean isDevelopmentBuild) Initializes the configuration system:- Extract defaults if missing
- Optionally update configs if outdated / dev build
- Load merged config into memory
-
ensureDefaultsExist
public void ensureDefaultsExist()Extracts jar defaults to disk if missing. Uses ResourceUtil copier (not JavaPlugin#saveDefaultConfig). -
reload
public void reload()Reloads configuration from disk (legacy single-file supported; otherwise merges folder mode). -
config
@NotNull public @NotNull org.bukkit.configuration.file.FileConfiguration config()Returns the currently loaded merged config (lazy loads if needed). -
updateIfNeeded
public void updateIfNeeded(boolean isDevelopmentBuild) Checks disk config-version and updates config files if needed, then reloads. This is the former Graves#updateConfig() logic, now owned here. -
getConfigSection
-
getConfigSection
-
getConfigSection
@Nullable public @Nullable org.bukkit.configuration.ConfigurationSection getConfigSection(String configKey, @NotNull @NotNull org.bukkit.entity.Entity entity) -
getConfigSection
-
getConfigSection
@Nullable public @Nullable org.bukkit.configuration.ConfigurationSection getConfigSection(String configKey, @Nullable @Nullable org.bukkit.entity.EntityType entityType, @Nullable @Nullable List<String> permissionList) Priority order:settings.permission.<perm>settings.entity.<ENTITYTYPE>settings.default.default
-
getPermissionList
@NotNull public @NotNull List<String> getPermissionList(@NotNull @NotNull org.bukkit.entity.Entity entity) Builds a sorted list of permission keys for a given player, matching config sections. -
getConfigFolder
-
getPluginsFolder
-