diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-08-16 21:54:31 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-08-16 21:54:31 +0700 |
commit | 794dcf0a1312b58cf1247c0907414fd1eb88e06d (patch) | |
tree | 7f3d608a901a0ac8164ca6a29a69410de7701dc8 /src/main/kotlin/cc/woverflow/chatting/Chatting.kt | |
parent | 89938d618307955ac1218b0f286bb1b1ce252e35 (diff) | |
download | Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.tar.gz Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.tar.bz2 Chatting-794dcf0a1312b58cf1247c0907414fd1eb88e06d.zip |
new: completely remove Essential
fix: fix copy chat button not rendering when patcher transparent chat is enabled
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/Chatting.kt')
-rw-r--r-- | src/main/kotlin/cc/woverflow/chatting/Chatting.kt | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt index 3b7eb8b..3aa6302 100644 --- a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt +++ b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt @@ -1,7 +1,10 @@ package cc.woverflow.chatting +import cc.polyfrost.oneconfig.libs.universal.UDesktop import cc.polyfrost.oneconfig.libs.universal.UResolution import cc.polyfrost.oneconfig.utils.commands.CommandManager +import cc.polyfrost.oneconfig.utils.dsl.browseLink +import cc.polyfrost.oneconfig.utils.notifications.Notifications import cc.woverflow.chatting.chat.ChatSearchingManager import cc.woverflow.chatting.chat.ChatShortcuts import cc.woverflow.chatting.chat.ChatSpamBlock @@ -42,7 +45,7 @@ import java.util.* modid = Chatting.ID, name = Chatting.NAME, version = Chatting.VER, - modLanguageAdapter = "gg.essential.api.utils.KotlinAdapter" + modLanguageAdapter = "cc.polyfrost.oneconfig.utils.KotlinLanguageAdapter" ) object Chatting { @@ -92,9 +95,9 @@ object Chatting { fun onForgeLoad(event: FMLLoadCompleteEvent) { if (ChattingConfig.informForAlternatives) { if (isHychat) { - //sendBrandedNotification(NAME, "Hychat can be removed as it is replaced by Chatting. Click here for more information.", action = { - // UDesktop.browseURL("https://microcontrollersdev.github.io/Alternatives/1.8.9/hychat") - //}) + Notifications.INSTANCE.send(NAME, "Hychat can be removed as it is replaced by Chatting. Click here for more information.") { + UDesktop.browseLink("https://microcontrollersdev.github.io/Alternatives/1.8.9/hychat") + } } if (isSkytils) { try { @@ -116,23 +119,23 @@ object Chatting { 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.save() - // skytilsClass.getMethod("markDirty").invoke(instance) - // skytilsClass.getMethod("writeData").invoke(instance) - //}) + Notifications.INSTANCE.send(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F) { + chatTabs.setBoolean(instance, false) + ChattingConfig.chatTabs = true + ChattingConfig.hypixelOnlyChatTabs = true + ChattingConfig.save() + 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) - //}) + Notifications.INSTANCE.send(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F) { + copyChat.setBoolean(instance, false) + skytilsClass.getMethod("markDirty").invoke(instance) + skytilsClass.getMethod("writeData").invoke(instance) + } } } @@ -197,11 +200,11 @@ object Chatting { private fun screenshot(messages: List<String>): BufferedImage? { if (messages.isEmpty()) { - //sendBrandedNotification("Chatting", "Chat window is empty.") + Notifications.INSTANCE.send("Chatting", "Chat window is empty.") return null } if (!OpenGlHelper.isFramebufferEnabled()) { - //sendBrandedNotification("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") + Notifications.INSTANCE.send("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") return null } @@ -220,11 +223,11 @@ object Chatting { val image = fb.screenshot(file) Minecraft.getMinecraft().entityRenderer.setupOverlayRendering() Minecraft.getMinecraft().framebuffer.bindFramebuffer(true) - //sendBrandedNotification("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else ""), action = { - // if (!UDesktop.open(file)) { - // sendBrandedNotification("Chatting", "Could not browse!") - // } - // }) + Notifications.INSTANCE.send("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else "")) { + if (!UDesktop.open(file)) { + Notifications.INSTANCE.send("Chatting", "Could not browse!") + } + } return image } } |