diff options
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/Chattils.kt (renamed from src/main/kotlin/com/raeids/stratus/Stratus.kt) | 48 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatRegexes.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatRegexes.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatSearchingManager.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatSearchingManager.kt) | 4 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatShortcuts.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatShortcuts.kt) | 14 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatTab.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatTab.kt) | 4 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatTabs.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatTabs.kt) | 6 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/chat/ChatTabsJson.kt (renamed from src/main/kotlin/com/raeids/stratus/chat/ChatTabsJson.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/command/ChattilsCommand.kt | 15 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt (renamed from src/main/kotlin/com/raeids/stratus/config/StratusConfig.kt) | 22 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutEditGui.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/ChatShortcutEditGui.kt) | 4 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutViewGui.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt) | 6 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/components/CleanButton.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/components/CleanButton.kt) | 6 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/components/ScreenshotButton.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/components/ScreenshotButton.kt) | 10 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/components/SearchButton.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/components/SearchButton.kt) | 8 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/components/TabButton.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/components/TabButton.kt) | 6 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/gui/components/TextBlock.kt (renamed from src/main/kotlin/com/raeids/stratus/gui/components/TextBlock.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/updater/DownloadGui.kt (renamed from src/main/kotlin/com/raeids/stratus/updater/DownloadGui.kt) | 14 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/updater/Updater.kt (renamed from src/main/kotlin/com/raeids/stratus/updater/Updater.kt) | 26 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/utils/ImageTransferable.kt (renamed from src/main/kotlin/com/raeids/stratus/utils/ImageTransferable.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/utils/ListenableArrayList.kt | 9 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/utils/ModCompatHooks.kt (renamed from src/main/kotlin/com/raeids/stratus/utils/ModCompatHooks.kt) | 10 | ||||
-rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/utils/RenderHelper.kt (renamed from src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt) | 8 | ||||
-rw-r--r-- | src/main/kotlin/com/raeids/stratus/command/StratusCommand.kt | 15 |
23 files changed, 129 insertions, 114 deletions
diff --git a/src/main/kotlin/com/raeids/stratus/Stratus.kt b/src/main/kotlin/cc/woverflow/chattils/Chattils.kt index b998d88..c9714a2 100644 --- a/src/main/kotlin/com/raeids/stratus/Stratus.kt +++ b/src/main/kotlin/cc/woverflow/chattils/Chattils.kt @@ -1,15 +1,15 @@ -package com.raeids.stratus - -import com.raeids.stratus.chat.ChatSearchingManager -import com.raeids.stratus.chat.ChatShortcuts -import com.raeids.stratus.chat.ChatTabs -import com.raeids.stratus.command.StratusCommand -import com.raeids.stratus.config.StratusConfig -import com.raeids.stratus.hook.GuiNewChatHook -import com.raeids.stratus.mixin.GuiNewChatAccessor -import com.raeids.stratus.updater.Updater -import com.raeids.stratus.utils.ModCompatHooks -import com.raeids.stratus.utils.RenderHelper +package cc.woverflow.chattils + +import cc.woverflow.chattils.chat.ChatSearchingManager +import cc.woverflow.chattils.chat.ChatShortcuts +import cc.woverflow.chattils.chat.ChatTabs +import cc.woverflow.chattils.command.ChattilsCommand +import cc.woverflow.chattils.config.ChattilsConfig +import cc.woverflow.chattils.hook.GuiNewChatHook +import cc.woverflow.chattils.mixin.GuiNewChatAccessor +import cc.woverflow.chattils.updater.Updater +import cc.woverflow.chattils.utils.ModCompatHooks +import cc.woverflow.chattils.utils.RenderHelper import gg.essential.api.EssentialAPI import gg.essential.universal.UDesktop import gg.essential.universal.UResolution @@ -36,14 +36,14 @@ import java.util.* @Mod( - modid = Stratus.ID, - name = Stratus.NAME, - version = Stratus.VER, + modid = Chattils.ID, + name = Chattils.NAME, + version = Chattils.VER, modLanguageAdapter = "gg.essential.api.utils.KotlinAdapter" ) -object Stratus { +object Chattils { - val keybind = KeyBinding("Screenshot Chat", Keyboard.KEY_NONE, "Stratus") + val keybind = KeyBinding("Screenshot Chat", Keyboard.KEY_NONE, "Chattils") const val NAME = "@NAME@" const val VER = "@VER@" const val ID = "@ID@" @@ -67,8 +67,8 @@ object Stratus { @Mod.EventHandler fun onInitialization(event: FMLInitializationEvent) { - StratusConfig.preload() - StratusCommand.register() + ChattilsConfig.preload() + ChattilsCommand.register() ClientRegistry.registerKeyBinding(keybind) EVENT_BUS.register(this) ChatTabs.initialize() @@ -93,7 +93,7 @@ object Stratus { } fun getChatHeight(opened: Boolean): Int { - var height = if (opened) StratusConfig.focusedHeight else StratusConfig.unfocusedHeight + var height = if (opened) ChattilsConfig.focusedHeight else ChattilsConfig.unfocusedHeight height = (height * Minecraft.getMinecraft().gameSettings.chatScale).toInt() val chatY = ModCompatHooks.yOffset + ModCompatHooks.chatPosition if (height + chatY + 27 > (UResolution.scaledHeight / Minecraft.getMinecraft().gameSettings.chatScale).toInt() - 27 - chatY) { @@ -118,7 +118,7 @@ object Stratus { val chat = hud.chatGUI val chatLines = ArrayList<String>() ChatSearchingManager.filterMessages((chat as GuiNewChatHook).prevText, (chat as GuiNewChatAccessor).drawnChatLines)?.let { drawnLines -> - val chatHeight = if (StratusConfig.customChatHeight) getChatHeight(true) / 9 else GuiNewChat.calculateChatboxHeight(Minecraft.getMinecraft().gameSettings.chatHeightFocused / 9) + val chatHeight = if (ChattilsConfig.customChatHeight) getChatHeight(true) / 9 else GuiNewChat.calculateChatboxHeight(Minecraft.getMinecraft().gameSettings.chatHeightFocused / 9) for (i in scrollPos until drawnLines.size.coerceAtMost(scrollPos + chatHeight)) { chatLines.add(drawnLines[i].chatComponent.formattedText) } @@ -131,7 +131,7 @@ object Stratus { private fun screenshot(messages: List<String>, width: Int): BufferedImage? { if (messages.isEmpty()) { - EssentialAPI.getNotifications().push("Stratus", "Chat window is empty.") + EssentialAPI.getNotifications().push("Chattils", "Chat window is empty.") return null } @@ -150,9 +150,9 @@ object Stratus { Minecraft.getMinecraft().entityRenderer.setupOverlayRendering() Minecraft.getMinecraft().framebuffer.bindFramebuffer(true) EssentialAPI.getNotifications() - .push("Stratus", "Chat screenshotted successfully.\nClick to open.") { + .push("Chattils", "Chat screenshotted successfully.\nClick to open.") { if (!UDesktop.browse(file.toURI())) { - EssentialAPI.getNotifications().push("Stratus", "Could not browse!") + EssentialAPI.getNotifications().push("Chattils", "Could not browse!") } } return image diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatRegexes.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatRegexes.kt index 4737177..0776fa0 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatRegexes.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatRegexes.kt @@ -1,4 +1,4 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat data class ChatRegexes(val regexList: List<String>?) { val compiledRegexList: MutableList<Regex> = arrayListOf() diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatSearchingManager.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatSearchingManager.kt index 030635b..646c218 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatSearchingManager.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatSearchingManager.kt @@ -1,6 +1,6 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat -import com.raeids.stratus.hook.GuiNewChatHook +import cc.woverflow.chattils.hook.GuiNewChatHook import gg.essential.lib.caffeine.cache.Cache import gg.essential.lib.caffeine.cache.Caffeine import gg.essential.universal.wrappers.message.UTextComponent diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatShortcuts.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatShortcuts.kt index 68fc18e..50cb73c 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatShortcuts.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatShortcuts.kt @@ -1,17 +1,23 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.utils.ListenableArrayList import com.google.gson.JsonObject import com.google.gson.JsonParser -import com.raeids.stratus.Stratus import java.io.File object ChatShortcuts { - private val shortcutsFile = File(Stratus.modDir, "chatshortcuts.json") + private val shortcutsFile = File(Chattils.modDir, "chatshortcuts.json") private val PARSER = JsonParser() private var initialized = false - val shortcuts = mutableSetOf<Pair<String, String>>() + val shortcuts = ListenableArrayList<Pair<String, String>>({ + it.sortWith(comparator) + }) + private val comparator = Comparator<Pair<String, String>> { o1, o2 -> + return@Comparator o2.first.length.compareTo(o1.first.length) + } fun initialize() { diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatTab.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTab.kt index ed6712c..87f28a1 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatTab.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTab.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat +import cc.woverflow.chattils.gui.components.TabButton import com.google.gson.annotations.SerializedName -import com.raeids.stratus.gui.components.TabButton import kotlinx.coroutines.runBlocking import net.minecraft.client.Minecraft import net.minecraft.util.EnumChatFormatting diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatTabs.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTabs.kt index 68e1d23..ada0baa 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatTabs.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTabs.kt @@ -1,10 +1,10 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat +import cc.woverflow.chattils.Chattils import com.google.gson.GsonBuilder import com.google.gson.JsonArray import com.google.gson.JsonObject import com.google.gson.JsonParser -import com.raeids.stratus.Stratus import net.minecraft.client.Minecraft import net.minecraft.util.IChatComponent import java.io.File @@ -24,7 +24,7 @@ object ChatTabs { } private var initialized = false - private val tabFile = File(Stratus.modDir, "chattabs.json") + private val tabFile = File(Chattils.modDir, "chattabs.json") fun initialize() { if (initialized) { diff --git a/src/main/kotlin/com/raeids/stratus/chat/ChatTabsJson.kt b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTabsJson.kt index 020c8fc..a63913b 100644 --- a/src/main/kotlin/com/raeids/stratus/chat/ChatTabsJson.kt +++ b/src/main/kotlin/cc/woverflow/chattils/chat/ChatTabsJson.kt @@ -1,4 +1,4 @@ -package com.raeids.stratus.chat +package cc.woverflow.chattils.chat import com.google.gson.JsonArray import com.google.gson.annotations.SerializedName diff --git a/src/main/kotlin/cc/woverflow/chattils/command/ChattilsCommand.kt b/src/main/kotlin/cc/woverflow/chattils/command/ChattilsCommand.kt new file mode 100644 index 0000000..aa162e1 --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chattils/command/ChattilsCommand.kt @@ -0,0 +1,15 @@ +package cc.woverflow.chattils.command + +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.config.ChattilsConfig +import gg.essential.api.EssentialAPI +import gg.essential.api.commands.Command +import gg.essential.api.commands.DefaultHandler + +object ChattilsCommand : Command(Chattils.ID, true) { + + @DefaultHandler + fun handle() { + EssentialAPI.getGuiUtil().openScreen(ChattilsConfig.gui()) + } +}
\ No newline at end of file diff --git a/src/main/kotlin/com/raeids/stratus/config/StratusConfig.kt b/src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt index 4e00bf8..77b9654 100644 --- a/src/main/kotlin/com/raeids/stratus/config/StratusConfig.kt +++ b/src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt @@ -1,12 +1,12 @@ -package com.raeids.stratus.config - -import com.raeids.stratus.Stratus -import com.raeids.stratus.chat.ChatShortcuts -import com.raeids.stratus.chat.ChatTab -import com.raeids.stratus.chat.ChatTabs -import com.raeids.stratus.gui.ChatShortcutViewGui -import com.raeids.stratus.updater.DownloadGui -import com.raeids.stratus.updater.Updater +package cc.woverflow.chattils.config + +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.chat.ChatShortcuts +import cc.woverflow.chattils.chat.ChatTab +import cc.woverflow.chattils.chat.ChatTabs +import cc.woverflow.chattils.gui.ChatShortcutViewGui +import cc.woverflow.chattils.updater.DownloadGui +import cc.woverflow.chattils.updater.Updater import gg.essential.api.EssentialAPI import gg.essential.vigilance.Vigilant import gg.essential.vigilance.data.Category @@ -15,7 +15,7 @@ import gg.essential.vigilance.data.PropertyType import gg.essential.vigilance.data.SortingBehavior import java.io.File -object StratusConfig : Vigilant(File(Stratus.modDir, "${Stratus.ID}.toml"), Stratus.NAME, sortingBehavior = ConfigSorting) { +object ChattilsConfig : Vigilant(File(Chattils.modDir, "${Chattils.ID}.toml"), Chattils.NAME, sortingBehavior = ConfigSorting) { @Property( type = PropertyType.SELECTOR, @@ -151,7 +151,7 @@ object StratusConfig : Vigilant(File(Stratus.modDir, "${Stratus.ID}.toml"), Stra if (Updater.shouldUpdate) EssentialAPI.getGuiUtil() .openScreen(DownloadGui()) else EssentialAPI.getNotifications() .push( - Stratus.NAME, + Chattils.NAME, "No update had been detected at startup, and thus the update GUI has not been shown." ) } diff --git a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutEditGui.kt b/src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutEditGui.kt index 6552c36..aa4b933 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutEditGui.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutEditGui.kt @@ -1,6 +1,6 @@ -package com.raeids.stratus.gui +package cc.woverflow.chattils.gui -import com.raeids.stratus.chat.ChatShortcuts +import cc.woverflow.chattils.chat.ChatShortcuts import gg.essential.api.EssentialAPI import gg.essential.api.gui.buildConfirmationModal import gg.essential.elementa.ElementaVersion diff --git a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt b/src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutViewGui.kt index 86989c4..f4ad049 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/ChatShortcutViewGui.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.gui +package cc.woverflow.chattils.gui -import com.raeids.stratus.chat.ChatShortcuts -import com.raeids.stratus.gui.components.TextBlock +import cc.woverflow.chattils.chat.ChatShortcuts +import cc.woverflow.chattils.gui.components.TextBlock import gg.essential.api.EssentialAPI import gg.essential.elementa.ElementaVersion import gg.essential.elementa.WindowScreen diff --git a/src/main/kotlin/com/raeids/stratus/gui/components/CleanButton.kt b/src/main/kotlin/cc/woverflow/chattils/gui/components/CleanButton.kt index 7ec29d4..7011518 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/components/CleanButton.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/components/CleanButton.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.gui.components +package cc.woverflow.chattils.gui.components +import cc.woverflow.chattils.Chattils import club.sk1er.patcher.config.PatcherConfig -import com.raeids.stratus.Stratus import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiButton import net.minecraft.client.renderer.GlStateManager @@ -41,7 +41,7 @@ open class CleanButton(buttonId: Int, private val x: () -> Int, private val y: ( GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) hovered = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height - if (!Stratus.isPatcher || !PatcherConfig.transparentChatInputField) { + if (!Chattils.isPatcher || !PatcherConfig.transparentChatInputField) { drawRect( xPosition, yPosition, diff --git a/src/main/kotlin/com/raeids/stratus/gui/components/ScreenshotButton.kt b/src/main/kotlin/cc/woverflow/chattils/gui/components/ScreenshotButton.kt index 9e6fa1f..0e6f088 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/components/ScreenshotButton.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/components/ScreenshotButton.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.gui.components +package cc.woverflow.chattils.gui.components -import com.raeids.stratus.Stratus -import com.raeids.stratus.mixin.GuiNewChatAccessor +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.mixin.GuiNewChatAccessor import gg.essential.api.utils.GuiUtil import gg.essential.universal.UResolution import net.minecraft.client.Minecraft @@ -16,7 +16,7 @@ class ScreenshotButton : override fun onMousePress() { val chat = Minecraft.getMinecraft().ingameGUI.chatGUI if (GuiUtil.getOpenedScreen() is GuiChat) { - Stratus.screenshotChat((chat as GuiNewChatAccessor).scrollPos) + Chattils.screenshotChat((chat as GuiNewChatAccessor).scrollPos) } } @@ -28,7 +28,7 @@ class ScreenshotButton : } else { GlStateManager.color(1f, 1f, 1f) } - mc.textureManager.bindTexture(ResourceLocation(Stratus.ID, "screenshot.png")) + mc.textureManager.bindTexture(ResourceLocation(Chattils.ID, "screenshot.png")) Gui.drawModalRectWithCustomSizedTexture(xPosition + 1, yPosition + 1, 0f, 0f, 10, 10, 10f, 10f) } } diff --git a/src/main/kotlin/com/raeids/stratus/gui/components/SearchButton.kt b/src/main/kotlin/cc/woverflow/chattils/gui/components/SearchButton.kt index 3180482..04a2743 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/components/SearchButton.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/components/SearchButton.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.gui.components +package cc.woverflow.chattils.gui.components -import com.raeids.stratus.Stratus -import com.raeids.stratus.hook.GuiNewChatHook +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.hook.GuiNewChatHook import gg.essential.universal.UResolution import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui @@ -30,7 +30,7 @@ class SearchButton : inputField.drawTextBox() super.drawButton(mc, mouseX, mouseY) if (visible) { - mc.textureManager.bindTexture(ResourceLocation(Stratus.ID, "search.png")) + mc.textureManager.bindTexture(ResourceLocation(Chattils.ID, "search.png")) if (isEnabled()) { GlStateManager.color(224f / 255f, 224f / 255f, 224f / 255f) } else if (mouseX >= xPosition && mouseX <= xPosition + 10 && mouseY >= yPosition && mouseY <= yPosition + 10) { diff --git a/src/main/kotlin/com/raeids/stratus/gui/components/TabButton.kt b/src/main/kotlin/cc/woverflow/chattils/gui/components/TabButton.kt index 48c399a..4770900 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/components/TabButton.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/components/TabButton.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.gui.components +package cc.woverflow.chattils.gui.components -import com.raeids.stratus.chat.ChatTab -import com.raeids.stratus.chat.ChatTabs +import cc.woverflow.chattils.chat.ChatTab +import cc.woverflow.chattils.chat.ChatTabs import gg.essential.universal.UResolution class TabButton(buttonId: Int, x: Int, widthIn: Int, heightIn: Int, private val chatTab: ChatTab) : diff --git a/src/main/kotlin/com/raeids/stratus/gui/components/TextBlock.kt b/src/main/kotlin/cc/woverflow/chattils/gui/components/TextBlock.kt index 63b3d01..c83d22d 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/components/TextBlock.kt +++ b/src/main/kotlin/cc/woverflow/chattils/gui/components/TextBlock.kt @@ -1,4 +1,4 @@ -package com.raeids.stratus.gui.components +package cc.woverflow.chattils.gui.components import gg.essential.elementa.components.UIBlock import gg.essential.elementa.components.UIText diff --git a/src/main/kotlin/com/raeids/stratus/updater/DownloadGui.kt b/src/main/kotlin/cc/woverflow/chattils/updater/DownloadGui.kt index 4fc465f..c7f59ec 100644 --- a/src/main/kotlin/com/raeids/stratus/updater/DownloadGui.kt +++ b/src/main/kotlin/cc/woverflow/chattils/updater/DownloadGui.kt @@ -1,6 +1,6 @@ -package com.raeids.stratus.updater +package cc.woverflow.chattils.updater -import com.raeids.stratus.Stratus +import cc.woverflow.chattils.Chattils import gg.essential.api.EssentialAPI import gg.essential.api.gui.buildConfirmationModal import gg.essential.api.utils.Multithreading @@ -15,32 +15,32 @@ class DownloadGui : WindowScreen(ElementaVersion.V1, true, true, true, -1) { EssentialAPI.getEssentialComponentFactory().buildConfirmationModal { this.text = "Are you sure you want to update?" this.secondaryText = - "(This will update from v${Stratus.VER} to ${Updater.latestTag})" + "(This will update from v${Chattils.VER} to ${Updater.latestTag})" this.onConfirm = { restorePreviousScreen() Multithreading.runAsync { if (Updater.download( Updater.updateUrl, File( - "mods/${Stratus.NAME}-${ + "mods/${Chattils.NAME}-${ Updater.latestTag!!.substringAfter("v") }.jar" ) ) && Updater.download( "https://github.com/Wyvest/Deleter/releases/download/v1.2/Deleter-1.2.jar", - File(Stratus.modDir.parentFile, "Deleter-1.2.jar") + File(Chattils.modDir.parentFile, "Deleter-1.2.jar") ) ) { EssentialAPI.getNotifications() .push( - Stratus.NAME, + Chattils.NAME, "The ingame updater has successfully installed the newest version." ) Updater.addShutdownHook() Updater.shouldUpdate = false } else { EssentialAPI.getNotifications().push( - Stratus.NAME, + Chattils.NAME, "The ingame updater has NOT installed the newest version as something went wrong." ) } diff --git a/src/main/kotlin/com/raeids/stratus/updater/Updater.kt b/src/main/kotlin/cc/woverflow/chattils/updater/Updater.kt index 22ac905..35b6e79 100644 --- a/src/main/kotlin/com/raeids/stratus/updater/Updater.kt +++ b/src/main/kotlin/cc/woverflow/chattils/updater/Updater.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.updater +package cc.woverflow.chattils.updater -import com.raeids.stratus.Stratus -import com.raeids.stratus.config.StratusConfig +import cc.woverflow.chattils.Chattils +import cc.woverflow.chattils.config.ChattilsConfig import gg.essential.api.EssentialAPI import gg.essential.api.utils.Multithreading import gg.essential.api.utils.WebUtil.downloadToFile @@ -21,13 +21,13 @@ object Updater { Multithreading.runAsync { try { val latestRelease = - fetchJSON("https://api.github.com/repos/W-OVERFLOW/${Stratus.ID}/releases/latest").getObject() + fetchJSON("https://api.github.com/repos/W-OVERFLOW/${Chattils.ID}/releases/latest").getObject() latestTag = latestRelease["tag_name"].asString val currentVersion = - DefaultArtifactVersion(Stratus.VER.substringBefore("-")) + DefaultArtifactVersion(Chattils.VER.substringBefore("-")) val latestVersion = DefaultArtifactVersion(latestTag!!.substringAfter("v").substringBefore("-")) if (currentVersion >= latestVersion) { - if (currentVersion != latestVersion || !Stratus.VER.contains("-")) { + if (currentVersion != latestVersion || !Chattils.VER.contains("-")) { return@runAsync } } @@ -35,10 +35,10 @@ object Updater { latestRelease["assets"].asJsonArray[0].asJsonObject["browser_download_url"] .asString if (updateUrl.isNotEmpty()) { - if (StratusConfig.showUpdate) { + if (ChattilsConfig.showUpdate) { EssentialAPI.getNotifications().push( - Stratus.NAME, - "${Stratus.NAME} has a new update ($latestTag)! Click here to download it automatically!" + Chattils.NAME, + "${Chattils.NAME} has a new update ($latestTag)! Click here to download it automatically!" ) { EssentialAPI.getGuiUtil().openScreen(DownloadGui()) } } shouldUpdate = true @@ -54,7 +54,7 @@ object Updater { if (file.exists()) return true url = url.replace(" ", "%20") try { - downloadToFile(url, file, "${Stratus.NAME}/${Stratus.VER}") + downloadToFile(url, file, "${Chattils.NAME}/${Chattils.VER}") } catch (e: Exception) { e.printStackTrace() return false @@ -72,11 +72,11 @@ object Updater { try { val runtime = javaRuntime if (Minecraft.isRunningOnMac) { - open(Stratus.jarFile.parentFile) + open(Chattils.jarFile.parentFile) } - val file = File(Stratus.modDir.parentFile, "Deleter-1.2.jar") + val file = File(Chattils.modDir.parentFile, "Deleter-1.2.jar") Runtime.getRuntime() - .exec("\"" + runtime + "\" -jar \"" + file.absolutePath + "\" \"" + Stratus.jarFile.absolutePath + "\"") + .exec("\"" + runtime + "\" -jar \"" + file.absolutePath + "\" \"" + Chattils.jarFile.absolutePath + "\"") } catch (e: Exception) { e.printStackTrace() } diff --git a/src/main/kotlin/com/raeids/stratus/utils/ImageTransferable.kt b/src/main/kotlin/cc/woverflow/chattils/utils/ImageTransferable.kt index a8fe9fb..b23e56e 100644 --- a/src/main/kotlin/com/raeids/stratus/utils/ImageTransferable.kt +++ b/src/main/kotlin/cc/woverflow/chattils/utils/ImageTransferable.kt @@ -1,4 +1,4 @@ -package com.raeids.stratus.utils +package cc.woverflow.chattils.utils import java.awt.Image import java.awt.datatransfer.DataFlavor diff --git a/src/main/kotlin/cc/woverflow/chattils/utils/ListenableArrayList.kt b/src/main/kotlin/cc/woverflow/chattils/utils/ListenableArrayList.kt new file mode 100644 index 0000000..3b270fd --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chattils/utils/ListenableArrayList.kt @@ -0,0 +1,9 @@ +package cc.woverflow.chattils.utils + +class ListenableArrayList<T>(private val runnable: (ListenableArrayList<T>) -> Unit, vararg elements: T): ArrayList<T>() { + override fun add(element: T): Boolean { + val value = super.add(element) + runnable.invoke(this) + return value + } +}
\ No newline at end of file diff --git a/src/main/kotlin/com/raeids/stratus/utils/ModCompatHooks.kt b/src/main/kotlin/cc/woverflow/chattils/utils/ModCompatHooks.kt index dde7165..65c80f0 100644 --- a/src/main/kotlin/com/raeids/stratus/utils/ModCompatHooks.kt +++ b/src/main/kotlin/cc/woverflow/chattils/utils/ModCompatHooks.kt @@ -1,11 +1,11 @@ -package com.raeids.stratus.utils +package cc.woverflow.chattils.utils import club.sk1er.patcher.config.PatcherConfig import com.llamalad7.betterchat.BetterChat -import com.raeids.stratus.Stratus.isBetterChat -import com.raeids.stratus.Stratus.isPatcher -import com.raeids.stratus.config.StratusConfig.textRenderType -import com.raeids.stratus.utils.RenderHelper.drawBorderedString +import cc.woverflow.chattils.Chattils.isBetterChat +import cc.woverflow.chattils.Chattils.isPatcher +import cc.woverflow.chattils.config.ChattilsConfig.textRenderType +import cc.woverflow.chattils.utils.RenderHelper.drawBorderedString import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer diff --git a/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt b/src/main/kotlin/cc/woverflow/chattils/utils/RenderHelper.kt index 9e454d7..41325ca 100644 --- a/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt +++ b/src/main/kotlin/cc/woverflow/chattils/utils/RenderHelper.kt @@ -1,7 +1,7 @@ -package com.raeids.stratus.utils +package cc.woverflow.chattils.utils -import com.raeids.stratus.config.StratusConfig -import com.raeids.stratus.hook.GuiNewChatHook +import cc.woverflow.chattils.config.ChattilsConfig +import cc.woverflow.chattils.hook.GuiNewChatHook import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer import net.minecraft.client.renderer.GlStateManager @@ -186,7 +186,7 @@ object RenderHelper { bufferedimage.setRGB(l, k - j, pixelValues[k * framebuffer.framebufferTextureWidth + l]) } } - if (StratusConfig.copyMode != 1) { + if (ChattilsConfig.copyMode != 1) { try { file.parentFile.mkdirs() ImageIO.write(bufferedimage, "png", file) diff --git a/src/main/kotlin/com/raeids/stratus/command/StratusCommand.kt b/src/main/kotlin/com/raeids/stratus/command/StratusCommand.kt deleted file mode 100644 index 2954885..0000000 --- a/src/main/kotlin/com/raeids/stratus/command/StratusCommand.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.raeids.stratus.command - -import com.raeids.stratus.Stratus -import com.raeids.stratus.config.StratusConfig -import gg.essential.api.EssentialAPI -import gg.essential.api.commands.Command -import gg.essential.api.commands.DefaultHandler - -object StratusCommand : Command(Stratus.ID, true) { - - @DefaultHandler - fun handle() { - EssentialAPI.getGuiUtil().openScreen(StratusConfig.gui()) - } -}
\ No newline at end of file |