aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--gradle.properties2
-rw-r--r--src/dummy/kotlin/skytils/skytilsmod/core/Config.kt14
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/Chatting.kt51
4 files changed, 37 insertions, 32 deletions
diff --git a/build.gradle b/build.gradle
index e4b3b7f..cbc862d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@
plugins {
id "dev.architectury.architectury-pack200" version "0.1.3"
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
- id "cc.woverflow.loom" version "0.10.6"
+ id "gg.essential.loom" version "0.10.0.3"
id "net.kyori.blossom" version "1.3.0"
id "java"
}
diff --git a/gradle.properties b/gradle.properties
index 3b11699..7999476 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx2G
mod_name = Chatting
mod_id = chatting
-mod_version = 1.4.0
+mod_version = 1.4.1
loom.platform = forge \ No newline at end of file
diff --git a/src/dummy/kotlin/skytils/skytilsmod/core/Config.kt b/src/dummy/kotlin/skytils/skytilsmod/core/Config.kt
deleted file mode 100644
index e01f5fa..0000000
--- a/src/dummy/kotlin/skytils/skytilsmod/core/Config.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package skytils.skytilsmod.core
-
-object Config {
- var chatTabs = false
- var copyChat = false
-
- fun markDirty() {
- throw AssertionError()
- }
-
- fun writeData() {
- throw AssertionError()
- }
-} \ No newline at end of file
diff --git a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt
index 0fe85f9..d012ab3 100644
--- a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt
+++ b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt
@@ -31,7 +31,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import org.lwjgl.input.Keyboard
-import skytils.skytilsmod.core.Config
import java.awt.image.BufferedImage
import java.io.File
import java.text.SimpleDateFormat
@@ -101,26 +100,46 @@ object Chatting {
})
}
if (isSkytils) {
- if (Config.chatTabs) {
- sendBrandedNotification(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = {
- Config.chatTabs = false
- ChattingConfig.chatTabs = true
- ChattingConfig.hypixelOnlyChatTabs = true
- Config.markDirty()
- Config.writeData()
- })
- }
- if (Config.copyChat) {
- sendBrandedNotification(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = {
- Config.copyChat = false
- Config.markDirty()
- Config.writeData()
- })
+ try {
+ skytilsCompat(Class.forName("gg.skytils.skytilsmod.core.Config"))
+ } catch (e: Exception) {
+ e.printStackTrace()
+ try {
+ skytilsCompat(Class.forName("skytils.skytilsmod.core.Config"))
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
}
}
}
}
+ private fun skytilsCompat(skytilsClass: Class<*>) {
+ val instance = skytilsClass.getDeclaredField("INSTANCE")
+ val chatTabs = skytilsClass.getDeclaredField("chatTabs")
+ chatTabs.isAccessible = true
+ if (chatTabs.getBoolean(instance)) {
+ sendBrandedNotification(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = {
+ chatTabs.setBoolean(instance, false)
+ ChattingConfig.chatTabs = true
+ ChattingConfig.hypixelOnlyChatTabs = true
+ ChattingConfig.markDirty()
+ ChattingConfig.writeData()
+ skytilsClass.getMethod("markDirty").invoke(instance)
+ skytilsClass.getMethod("writeData").invoke(instance)
+ })
+ }
+ val copyChat = skytilsClass.getDeclaredField("chatTabs")
+ copyChat.isAccessible = true
+ if (copyChat.getBoolean(instance)) {
+ sendBrandedNotification(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = {
+ copyChat.setBoolean(instance, false)
+ skytilsClass.getMethod("markDirty").invoke(instance)
+ skytilsClass.getMethod("writeData").invoke(instance)
+ })
+ }
+ }
+
@SubscribeEvent
fun onTickEvent(event: TickEvent.ClientTickEvent) {
if (event.phase == TickEvent.Phase.START && Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null && (Minecraft.getMinecraft().currentScreen == null || Minecraft.getMinecraft().currentScreen is GuiChat)) {