refactor: remove bots.chomens.authKey from config (migration V2 !!!)

This commit is contained in:
Chayapak Supasakul 2025-03-22 19:41:38 +07:00
parent c5fbd67510
commit aaf7a44d95
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
3 changed files with 25 additions and 4 deletions

View file

@ -3,6 +3,7 @@ package land.chipmunk.chipmunkmod.config;
import land.chipmunk.chipmunkmod.config.migration.AbstractMigrationManager;
import land.chipmunk.chipmunkmod.config.migrations.MigrationV0;
import land.chipmunk.chipmunkmod.config.migrations.MigrationV1;
import land.chipmunk.chipmunkmod.config.migrations.MigrationV2;
public final class ChipmunkModMigrations extends AbstractMigrationManager {
public ChipmunkModMigrations() {
@ -10,5 +11,6 @@ public final class ChipmunkModMigrations extends AbstractMigrationManager {
this.register(new MigrationV0()); // unversioned -> v0
this.register(new MigrationV1());
this.register(new MigrationV2());
}
}

View file

@ -30,7 +30,7 @@ public class Configuration {
public BotInfo hbot = new BotInfo("#", null);
public BotInfo sbot = new BotInfo(":", null);
public BotInfo chipmunk = new BotInfo("'", null);
public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, null, null);
public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, null);
public BotInfo fnfboyfriend = new BotInfo("~", null);
public BotInfo nbot = new BotInfo("?", null);
public BotInfo kittycorp = new BotInfo("^", null);
@ -41,16 +41,14 @@ public class Configuration {
public static class ChomeNSBotInfo {
public String prefix;
public @Nullable String key;
public @Nullable String authKey;
public @Nullable String formatKey;
public ChomeNSBotInfo() {
}
public ChomeNSBotInfo(String prefix, @Nullable String key, @Nullable String authKey, @Nullable String formatKey) {
public ChomeNSBotInfo(String prefix, @Nullable String key, @Nullable String formatKey) {
this.prefix = prefix;
this.key = key;
this.authKey = authKey;
this.formatKey = formatKey;
}
}

View file

@ -0,0 +1,21 @@
package land.chipmunk.chipmunkmod.config.migrations;
import land.chipmunk.chipmunkmod.config.migration.ConfigMigration;
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
import org.spongepowered.configurate.transformation.TransformAction;
import static org.spongepowered.configurate.NodePath.path;
public class MigrationV2 implements ConfigMigration {
@Override
public int version() {
return 2;
}
@Override
public ConfigurationTransformation create() {
return ConfigurationTransformation.builder()
.addAction(path("bots", "chomens", "authKey"), TransformAction.remove())
.build();
}
}