diff --git a/eco-api/src/main/java/com/willfp/eco/core/config/BaseConfig.java b/eco-api/src/main/java/com/willfp/eco/core/config/BaseConfig.java index 1b961ab5..1951f536 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/config/BaseConfig.java +++ b/eco-api/src/main/java/com/willfp/eco/core/config/BaseConfig.java @@ -23,13 +23,31 @@ public abstract class BaseConfig extends LoadableConfigWrapper { @NotNull final PluginLike plugin, final boolean removeUnused, @NotNull final ConfigType type) { + this(configName, plugin, removeUnused, type, true); + } + + /** + * Create new Base Config. + * + * @param plugin The plugin or extension. + * @param configName The config name (excluding extension). + * @param removeUnused If unused sections should be removed. + * @param type The config type. + * @param requiresChangeToSave If changes must be applied to save the config. + */ + protected BaseConfig(@NotNull final String configName, + @NotNull final PluginLike plugin, + final boolean removeUnused, + @NotNull final ConfigType type, + final boolean requiresChangeToSave) { super(Eco.getHandler().getConfigFactory().createUpdatableConfig( configName, plugin, "", plugin.getClass(), removeUnused, - type + type, + requiresChangeToSave )); } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java b/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java index 00666a93..c9515dc8 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java +++ b/eco-api/src/main/java/com/willfp/eco/core/config/interfaces/Config.java @@ -30,8 +30,13 @@ import java.util.Set; public interface Config extends Cloneable, PlaceholderInjectable { /** * Clears cache. + *
+ * Configs no longer have caches as they have in previous versions.
*/
- void clearCache();
+ @Deprecated(since = "6.31.1", forRemoval = true)
+ default void clearCache() {
+ // Do nothing.
+ }
/**
* Convert the config into readable text.
diff --git a/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigFactory.java b/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigFactory.java
index 033e7e32..7fc4a68a 100644
--- a/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigFactory.java
+++ b/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigFactory.java
@@ -20,13 +20,14 @@ public interface ConfigFactory {
/**
* Updatable config.
*
- * @param configName The name of the config
- * @param plugin The plugin.
- * @param subDirectoryPath The subdirectory path.
- * @param source The class that owns the resource.
- * @param removeUnused Whether keys not present in the default config should be removed on update.
- * @param type The config type.
- * @param updateBlacklist Substring of keys to not add/remove keys for.
+ * @param configName The name of the config
+ * @param plugin The plugin.
+ * @param subDirectoryPath The subdirectory path.
+ * @param source The class that owns the resource.
+ * @param removeUnused Whether keys not present in the default config should be removed on update.
+ * @param type The config type.
+ * @param updateBlacklist Substring of keys to not add/remove keys for.
+ * @param requiresChangesToSave If the config must be changed in order to save the config.
* @return The config implementation.
*/
LoadableConfig createUpdatableConfig(@NotNull String configName,
@@ -35,23 +36,26 @@ public interface ConfigFactory {
@NotNull Class> source,
boolean removeUnused,
@NotNull ConfigType type,
+ boolean requiresChangesToSave,
@NotNull String... updateBlacklist);
/**
* Loadable config.
*
- * @param configName The name of the config
- * @param plugin The plugin.
- * @param subDirectoryPath The subdirectory path.
- * @param source The class that owns the resource.
- * @param type The config type.
+ * @param configName The name of the config
+ * @param plugin The plugin.
+ * @param subDirectoryPath The subdirectory path.
+ * @param source The class that owns the resource.
+ * @param type The config type.
+ * @param requiresChangesToSave If the config must be changed in order to save the config.
* @return The config implementation.
*/
LoadableConfig createLoadableConfig(@NotNull String configName,
@NotNull PluginLike plugin,
@NotNull String subDirectoryPath,
@NotNull Class> source,
- @NotNull ConfigType type);
+ @NotNull ConfigType type,
+ boolean requiresChangesToSave);
/**
* Create config.
diff --git a/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigWrapper.java b/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigWrapper.java
index 669b1135..77ec4ebd 100644
--- a/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigWrapper.java
+++ b/eco-api/src/main/java/com/willfp/eco/core/config/wrapper/ConfigWrapper.java
@@ -19,7 +19,7 @@ import java.util.Set;
*
* @param