Skip to content

Commit

Permalink
Remove old config migrator, register new one
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Mar 11, 2024
1 parent 73684d6 commit fcf9acd
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions core/src/main/java/com/rappytv/toolwarn/TbwAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import com.rappytv.toolwarn.config.TbwConfiguration;
import com.rappytv.toolwarn.core.generated.DefaultReferenceStorage;
import com.rappytv.toolwarn.listener.ConfigMigrationListener;
import com.rappytv.toolwarn.listener.GameTickListener;
import com.rappytv.toolwarn.util.ITbwSounds;
import com.rappytv.toolwarn.util.WarnSound;
import com.rappytv.toolwarn.util.WarnTool;
import com.rappytv.toolwarn.util.WarnTool.Type;
import net.labymod.api.Laby;
import net.labymod.api.addon.LabyAddon;
import net.labymod.api.client.component.Component;
Expand All @@ -28,6 +26,7 @@ public class TbwAddon extends LabyAddon<TbwConfiguration> {
protected void preConfigurationLoad() {
Laby.references().revisionRegistry().register(new SimpleRevision("toolwarn", new SemanticVersion("1.3.4"), "2024-01-26"));
Laby.references().revisionRegistry().register(new SimpleRevision("toolwarn", new SemanticVersion("1.4.0"), "2024-03-09"));
registerListener(new ConfigMigrationListener());
}

@Override
Expand All @@ -39,7 +38,6 @@ protected void enable() {
registerSettingCategory();
instance = this;

migrateConfig();
registerListener(new GameTickListener(this));
}

Expand All @@ -55,23 +53,4 @@ public static ITbwSounds getSounds() {
protected Class<? extends TbwConfiguration> configurationClass() {
return TbwConfiguration.class;
}

private void migrateConfig() {
if(configuration().getConfigVersion() == 1) {
WarnSound warnSound = WarnSound.NONE;
WarnSound lastHitSound = WarnSound.NONE;
boolean openChat = true;
boolean lastHitWarn = true;

configuration().getTools().add(new WarnTool(Type.SWORD, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.PICKAXE, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.AXE, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.SHOVEL, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.CROSSBOW, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.LIGHTER, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.SHEARS, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().getTools().add(new WarnTool(Type.TRIDENT, warnSound, lastHitSound, 5, openChat, lastHitWarn));
configuration().usedConfigVersion().set(2);
}
}
}

0 comments on commit fcf9acd

Please sign in to comment.