Bump config version because we're getting tons of changes

This commit is contained in:
Minecon724 2024-12-31 16:38:33 +01:00
parent 9e4125dd4e
commit 3a6d1366ab
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
2 changed files with 4 additions and 3 deletions

View file

@ -59,7 +59,7 @@ public record TweaksConfig(
Map<String, Object> knockbackModifiers Map<String, Object> knockbackModifiers
) { ) {
public static final int CONFIG_VERSION = 1; public static final int CONFIG_VERSION = 2;
private static TweaksConfig config; private static TweaksConfig config;
public static TweaksConfig getConfig() { public static TweaksConfig getConfig() {
@ -72,10 +72,11 @@ public record TweaksConfig(
int configVersion = config.getInt("magic number don't modify this", 0); int configVersion = config.getInt("magic number don't modify this", 0);
RuntimeException exception = new RuntimeException("Config version is %d, expected %d".formatted(configVersion, CONFIG_VERSION)); RuntimeException exception = new RuntimeException("Config version is %d, expected %d".formatted(configVersion, CONFIG_VERSION));
if (configVersion == 0) { if (configVersion == 0) {
throw exception; throw exception;
} else if (configVersion > CONFIG_VERSION) { } else if (configVersion > CONFIG_VERSION) {
throw new RuntimeException("Please follow update instructions", exception); throw new RuntimeException("Please follow update instructions https://www.spigotmc.org/resources/tweaks724.121057/updates", exception);
} else if (configVersion < CONFIG_VERSION) { } else if (configVersion < CONFIG_VERSION) {
throw new RuntimeException("Did you downgrade the plugin? Remove config.yml and let the plugin re-create it", exception); throw new RuntimeException("Did you downgrade the plugin? Remove config.yml and let the plugin re-create it", exception);
} }

View file

@ -120,4 +120,4 @@ knockback:
# Finally, thank you for downloading Tweaks724, I hope you enjoy! # Finally, thank you for downloading Tweaks724, I hope you enjoy!
# Don't modify unless told to # Don't modify unless told to
magic number don't modify this: 1 magic number don't modify this: 2