From ebeef89a1936ebcc27f57c2395cf433ee64f6f9b Mon Sep 17 00:00:00 2001 From: ev chang Date: Thu, 20 Jun 2024 23:54:24 +0700 Subject: [PATCH] ACTUALLY fix the condition this time --- .../polyfrost/hytils/config/HytilsConfig.java | 19 +++++++++++-------- .../chat/modules/triggers/AutoGG.java | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index bc4337a..bdc2167 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -1245,17 +1245,20 @@ public HytilsConfig() { } initialize(); + Class autoGGClass = null; + try { + autoGGClass = Class.forName("club.sk1er.mods.autogg.config.AutoGGConfig"); + + HytilsReborn.INSTANCE.isSk1erAutoGG = true; + } catch (ClassNotFoundException ignored) { + } if (configNumber != 3) { // Config version has not been set or is outdated if (configNumber == 1) { overlayAmount = 300; } if (configNumber <= 2) { - try { - Class clazz = Class.forName("club.sk1er.mods.autogg.config.AutoGGConfig"); - - HytilsReborn.INSTANCE.isSk1erAutoGG = true; - + if (autoGGClass != null) { if (AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()) { autoGG = true; } @@ -1285,7 +1288,7 @@ public HytilsConfig() { } try { - Field sk1erEnabled = clazz.getDeclaredField("autoGGEnabled"); + Field sk1erEnabled = autoGGClass.getDeclaredField("autoGGEnabled"); sk1erEnabled.setAccessible(true); sk1erEnabled.set(AutoGG.INSTANCE.getAutoGGConfig(), false); @@ -1296,9 +1299,8 @@ public HytilsConfig() { } Notifications.INSTANCE.send("Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's AutoGG.", 5); - } catch (ClassNotFoundException ignored) { - } + try { Class.forName("club.sk1er.lobbysounds.config.Sounds"); boolean modified = false; @@ -1418,6 +1420,7 @@ public HytilsConfig() { addDependency("autoGGFirstPhraseDelay", "Sk1er's AutoGG Enabled", autoGGEnabled); addDependency("autoGGMessage2", "Sk1er's AutoGG Enabled", autoGGEnabled); addDependency("autoGGSecondPhraseDelay", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("antiGG", "Sk1er's AutoGG Enabled", autoGGEnabled); addDependency("glPhrase", "autoGL"); diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java index 30e8021..0a4f2ab 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java @@ -66,7 +66,7 @@ private boolean hasGameEnded(String message) { @Override public boolean isEnabled() { - return HytilsConfig.autoGG && (!HytilsReborn.INSTANCE.isSk1erAutoGG || club.sk1er.mods.autogg.AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()); // If Sk1er's AutoGG is enabled, we don't want to interfere with it. + return HytilsConfig.autoGG && (!HytilsReborn.INSTANCE.isSk1erAutoGG || !club.sk1er.mods.autogg.AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()); // If Sk1er's AutoGG is enabled, we don't want to interfere with it. } @Override