config: Deprecate feature flag class

This commit is contained in:
Oliver
2025-07-19 19:32:51 +02:00
parent e005e5c212
commit b8512e503d
6 changed files with 83 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
package de.oliver.fancylib; package com.fancyinnovations.config;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;

View File

@@ -1,5 +1,9 @@
package com.fancyinnovations.config.featureflags; package com.fancyinnovations.config.featureflags;
/**
* Use ConfigOption instead of this class.
*/
@Deprecated
public class FeatureFlag { public class FeatureFlag {
private final String name; private final String name;

View File

@@ -8,6 +8,10 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* Use Config instead of this class.
*/
@Deprecated
public class FeatureFlagConfig { public class FeatureFlagConfig {
private final Plugin plugin; private final Plugin plugin;

View File

@@ -1,7 +1,7 @@
package com.fancyinnovations.fancydialogs.config; package com.fancyinnovations.fancydialogs.config;
import com.fancyinnovations.config.ConfigHelper;
import com.fancyinnovations.fancydialogs.FancyDialogsPlugin; import com.fancyinnovations.fancydialogs.FancyDialogsPlugin;
import de.oliver.fancylib.ConfigHelper;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import java.util.List; import java.util.List;

View File

@@ -1,8 +1,8 @@
package de.oliver.fancyholograms; package de.oliver.fancyholograms;
import com.fancyinnovations.config.ConfigHelper;
import de.oliver.fancyholograms.api.FancyHologramsPlugin; import de.oliver.fancyholograms.api.FancyHologramsPlugin;
import de.oliver.fancyholograms.api.HologramConfiguration; import de.oliver.fancyholograms.api.HologramConfiguration;
import de.oliver.fancylib.ConfigHelper;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -17,65 +17,17 @@ import java.util.Map;
*/ */
public final class FancyHologramsConfiguration implements HologramConfiguration { public final class FancyHologramsConfiguration implements HologramConfiguration {
/**
* Indicates whether autosave is enabled.
*/
private boolean autosaveEnabled;
private static final String CONFIG_AUTOSAVE_ENABLED = "saving.autosave.enabled"; private static final String CONFIG_AUTOSAVE_ENABLED = "saving.autosave.enabled";
/**
* The interval at which autosave is performed.
*/
private int autosaveInterval;
private static final String CONFIG_AUTOSAVE_INTERVAL = "saving.autosave.interval"; private static final String CONFIG_AUTOSAVE_INTERVAL = "saving.autosave.interval";
/**
* Indicates whether the plugin should save holograms when they are changed.
*/
private boolean saveOnChangedEnabled;
private static final String CONFIG_SAVE_ON_CHANGED = "saving.save_on_changed"; private static final String CONFIG_SAVE_ON_CHANGED = "saving.save_on_changed";
/**
* The log level for the plugin.
*/
private String logLevel;
private static final String CONFIG_LOG_LEVEL = "logging.log_level"; private static final String CONFIG_LOG_LEVEL = "logging.log_level";
/**
* Indicates whether hologram loading should be logged on world loading.
*/
private boolean hologramLoadLogging;
private static final String CONFIG_LOG_ON_WORLD_LOAD = "logging.log_on_world_load"; private static final String CONFIG_LOG_ON_WORLD_LOAD = "logging.log_on_world_load";
/**
* Indicates whether version notifications are enabled or disabled.
*/
private boolean versionNotifs;
private static final String CONFIG_VERSION_NOTIFICATIONS = "logging.version_notifications"; private static final String CONFIG_VERSION_NOTIFICATIONS = "logging.version_notifications";
/**
* The default visibility distance for holograms.
*/
private int defaultVisibilityDistance;
private static final String CONFIG_VISIBILITY_DISTANCE = "visibility_distance"; private static final String CONFIG_VISIBILITY_DISTANCE = "visibility_distance";
/**
* Indicates whether commands should be registered.
* <p>
* This is useful for users who want to use the plugin's API only.
*/
private boolean registerCommands;
private static final String CONFIG_REGISTER_COMMANDS = "register_commands"; private static final String CONFIG_REGISTER_COMMANDS = "register_commands";
/**
* The interval at which hologram visibility is updated.
*/
private int updateVisibilityInterval;
private static final String CONFIG_UPDATE_VISIBILITY_INTERVAL = "update_visibility_interval"; private static final String CONFIG_UPDATE_VISIBILITY_INTERVAL = "update_visibility_interval";
private static final String CONFIG_REPORT_ERRORS_TO_SENTRY = "report_errors_to_sentry"; private static final String CONFIG_REPORT_ERRORS_TO_SENTRY = "report_errors_to_sentry";
private static final String CONFIG_VERSION = "config_version"; private static final String CONFIG_VERSION = "config_version";
private static final Map<String, List<String>> CONFIG_COMMENTS = Map.of( private static final Map<String, List<String>> CONFIG_COMMENTS = Map.of(
CONFIG_VERSION, List.of("Config version, do not modify."), CONFIG_VERSION, List.of("Config version, do not modify."),
CONFIG_AUTOSAVE_ENABLED, List.of("Whether autosave is enabled."), CONFIG_AUTOSAVE_ENABLED, List.of("Whether autosave is enabled."),
@@ -88,6 +40,44 @@ public final class FancyHologramsConfiguration implements HologramConfiguration
CONFIG_REGISTER_COMMANDS, List.of("Whether the plugin should register its commands."), CONFIG_REGISTER_COMMANDS, List.of("Whether the plugin should register its commands."),
CONFIG_UPDATE_VISIBILITY_INTERVAL, List.of("The interval at which hologram visibility is updated in ticks.") CONFIG_UPDATE_VISIBILITY_INTERVAL, List.of("The interval at which hologram visibility is updated in ticks.")
); );
/**
* Indicates whether autosave is enabled.
*/
private boolean autosaveEnabled;
/**
* The interval at which autosave is performed.
*/
private int autosaveInterval;
/**
* Indicates whether the plugin should save holograms when they are changed.
*/
private boolean saveOnChangedEnabled;
/**
* The log level for the plugin.
*/
private String logLevel;
/**
* Indicates whether hologram loading should be logged on world loading.
*/
private boolean hologramLoadLogging;
/**
* Indicates whether version notifications are enabled or disabled.
*/
private boolean versionNotifs;
/**
* The default visibility distance for holograms.
*/
private int defaultVisibilityDistance;
/**
* Indicates whether commands should be registered.
* <p>
* This is useful for users who want to use the plugin's API only.
*/
private boolean registerCommands;
/**
* The interval at which hologram visibility is updated.
*/
private int updateVisibilityInterval;
private void updateChecker(@NotNull FancyHolograms plugin, @NotNull FileConfiguration config) { private void updateChecker(@NotNull FancyHolograms plugin, @NotNull FileConfiguration config) {
final int latestVersion = 1; final int latestVersion = 1;

View File

@@ -1,6 +1,6 @@
package de.oliver.fancynpcs; package de.oliver.fancynpcs;
import de.oliver.fancylib.ConfigHelper; import com.fancyinnovations.config.ConfigHelper;
import de.oliver.fancynpcs.api.FancyNpcsConfig; import de.oliver.fancynpcs.api.FancyNpcsConfig;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;