diff --git a/src/client/java/dev/xdpxi/xdlib/config/changelogConfig.java b/src/client/java/dev/xdpxi/xdlib/config/changelogConfig.java deleted file mode 100644 index d25cfc7..0000000 --- a/src/client/java/dev/xdpxi/xdlib/config/changelogConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -package dev.xdpxi.xdlib.config; - -import org.tomlj.Toml; -import org.tomlj.TomlTable; - -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; - -public class changelogConfig { - private static final String CONFIG_FILE_NAME = "version.toml"; - private final File configFile; - - public changelogConfig() { - File configDir = new File("config" + File.separator + "xdlib"); - - if (!configDir.exists()) { - configDir.mkdirs(); - } - configFile = new File(configDir, CONFIG_FILE_NAME); - - if (!configFile.exists()) { - write(new ConfigData()); - } - } - - public void write(ConfigData configData) { - try { - if (!configFile.exists()) { - configFile.createNewFile(); - } - String tomlString = String.format("version = %d", configData.getVersion()); - try (FileWriter writer = new FileWriter(configFile)) { - writer.write(tomlString); - } - } catch (IOException ignored) { - } - } - - public ConfigData read() { - try (FileReader reader = new FileReader(configFile)) { - TomlTable table = Toml.parse(reader); - int version = table.getLong("version").intValue(); - ConfigData configData = new ConfigData(); - configData.setVersion(version); - return configData; - } catch (IOException ignored) { - return null; - } - } - - public static class ConfigData { - private int version = 0; - - public int getVersion() { - return version; - } - - public void setVersion(int var) { - version = var; - } - } -} \ No newline at end of file diff --git a/src/client/java/dev/xdpxi/xdlib/mixin/client/TitleScreenMixin.java b/src/client/java/dev/xdpxi/xdlib/mixin/client/TitleScreenMixin.java index 3032549..72eae02 100644 --- a/src/client/java/dev/xdpxi/xdlib/mixin/client/TitleScreenMixin.java +++ b/src/client/java/dev/xdpxi/xdlib/mixin/client/TitleScreenMixin.java @@ -1,7 +1,5 @@ package dev.xdpxi.xdlib.mixin.client; -import dev.xdpxi.xdlib.config.changelogConfig; -import dev.xdpxi.xdlib.config.configManager; import dev.xdpxi.xdlib.support; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; @@ -20,36 +18,22 @@ public class TitleScreenMixin { @Unique private static boolean Shown = false; - @Unique - private static int version = 12; - @Inject(method = "init", at = @At("TAIL")) public void onInit(CallbackInfo ci) { - changelogConfig config = new changelogConfig(); - changelogConfig.ConfigData loadedData = config.read(); - int configVersion = loadedData.getVersion(); - boolean firstStartup = version != configVersion; - boolean changelogEveryStartup = configManager.configData.isChangelogEveryStartup(); - boolean disableChangelog = configManager.configData.isDisableChangelog(); - - if (((firstStartup || changelogEveryStartup) && !Shown) && !disableChangelog) { - // do nothing - } else { - if (!Shown) { - CompletableFuture.supplyAsync(() -> { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return 0; - }).thenAcceptAsync(result -> { - Shown = true; - MinecraftClient client = MinecraftClient.getInstance(); - Screen currentScreen = client.currentScreen; - client.execute(() -> client.setScreen(new support(Text.empty(), currentScreen))); - }, MinecraftClient.getInstance()); - } + if (!Shown) { + CompletableFuture.supplyAsync(() -> { + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return 0; + }).thenAcceptAsync(result -> { + Shown = true; + MinecraftClient client = MinecraftClient.getInstance(); + Screen currentScreen = client.currentScreen; + client.execute(() -> client.setScreen(new support(Text.empty(), currentScreen))); + }, MinecraftClient.getInstance()); } } } \ No newline at end of file