diff options
| author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-01 22:11:34 +0700 |
|---|---|---|
| committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-01 22:11:34 +0700 |
| commit | cc4a11c7943d9036dc71679eaa531832cd2a2f0c (patch) | |
| tree | da242580d43fa6f26f0b0b04deab82c200a5bb16 /src/main/kotlin/cc/woverflow/chattils/config | |
| parent | 856df4d08d3c392b35f256966f6263da86fdb7ab (diff) | |
| download | Chatting-cc4a11c7943d9036dc71679eaa531832cd2a2f0c.tar.gz Chatting-cc4a11c7943d9036dc71679eaa531832cd2a2f0c.tar.bz2 Chatting-cc4a11c7943d9036dc71679eaa531832cd2a2f0c.zip | |
Chattils 1.0.0
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chattils/config')
| -rw-r--r-- | src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt b/src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt new file mode 100644 index 0000000..77b9654 --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chattils/config/ChattilsConfig.kt @@ -0,0 +1,187 @@ +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 +import gg.essential.vigilance.data.Property +import gg.essential.vigilance.data.PropertyType +import gg.essential.vigilance.data.SortingBehavior +import java.io.File + +object ChattilsConfig : Vigilant(File(Chattils.modDir, "${Chattils.ID}.toml"), Chattils.NAME, sortingBehavior = ConfigSorting) { + + @Property( + type = PropertyType.SELECTOR, + name = "Text Render Type", + description = "Choose the type of rendering for the text.", + category = "General", + options = ["No Shadow", "Shadow", "Full Shadow"] + ) + var textRenderType = 1 + + @Property( + type = PropertyType.SWITCH, + name = "Custom Chat Height", + description = "Allows you to change the height of chat to heights greater than before.", + category = "Chat Window" + ) + var customChatHeight = true + + @Property( + type = PropertyType.SLIDER, + min = 180, + max = 10000, + name = "Focused Height", + description = "Height in pixels.", + category = "Chat Window" + ) + var focusedHeight = 180 + + @Property( + type = PropertyType.SLIDER, + min = 180, + max = 10000, + name = "Unfocused Height", + description = "Height in pixels.", + category = "Chat Window" + ) + var unfocusedHeight = 180 + + @Property( + type = PropertyType.SELECTOR, + name = "Screenshot Mode", + description = "The mode in which screenshotting will work.", + category = "Screenshotting", + options = [ + "Save To System", + "Add To Clipboard", + "Both" + ] + ) + var copyMode = 0 + + @Property( + type = PropertyType.SWITCH, + name = "Chat Searching", + description = "Add a chat search bar.", + category = "Searching" + ) + var chatSearch = true + + @Property( + type = PropertyType.SWITCH, + name = "Chat Tabs", + description = "Add chat tabs.", + category = "Tabs" + ) + var chatTabs = true + get() { + if (!field) return false + return if (hypixelOnlyChatTabs) { + EssentialAPI.getMinecraftUtil().isHypixel() + } else { + true + } + } + + @Property( + type = PropertyType.SWITCH, + name = "Enable Tabs Only on Hypixel", + description = "Enable chat tabs only in Hypixel.", + category = "Tabs" + ) + var hypixelOnlyChatTabs = true + + @Property( + type = PropertyType.SWITCH, + name = "Chat Shortcuts", + description = "Add chat shortcuts.", + category = "Shortcuts" + ) + var chatShortcuts = false + get() { + if (!field) return false + return if (hypixelOnlyChatShortcuts) { + EssentialAPI.getMinecraftUtil().isHypixel() + } else { + true + } + } + + @Property( + type = PropertyType.SWITCH, + name = "Enable Shortcuts Only on Hypixel", + description = "Enable chat shortcuts only in Hypixel.", + category = "Shortcuts" + ) + var hypixelOnlyChatShortcuts = true + + @Property( + type = PropertyType.BUTTON, + name = "Edit Chat Shortcuts", + description = "Edit chat shortcuts.", + category = "Shortcuts" + ) + fun openChatShortcutsGUI() { + EssentialAPI.getGuiUtil().openScreen(ChatShortcutViewGui()) + } + + @Property( + type = PropertyType.SWITCH, + name = "Show Update Notification", + description = "Show a notification when you start Minecraft informing you of new updates.", + category = "Updater" + ) + var showUpdate = true + + @Property( + type = PropertyType.BUTTON, + name = "Update Now", + description = "Update by clicking the button.", + category = "Updater" + ) + fun update() { + if (Updater.shouldUpdate) EssentialAPI.getGuiUtil() + .openScreen(DownloadGui()) else EssentialAPI.getNotifications() + .push( + Chattils.NAME, + "No update had been detected at startup, and thus the update GUI has not been shown." + ) + } + + init { + initialize() + registerListener("chatTabs") { funny: Boolean -> + chatTabs = funny + ChatTabs.initialize() + if (!funny) { + val dummy = ChatTab(true, "ALL", false, null, null, null, null, null, "") + dummy.initialize() + ChatTabs.currentTab = dummy + } else { + ChatTabs.currentTab = ChatTabs.tabs[0] + } + } + registerListener("chatShortcuts") { funny: Boolean -> + chatShortcuts = funny + ChatShortcuts.initialize() + } + } + + private object ConfigSorting : SortingBehavior() { + override fun getCategoryComparator(): Comparator<in Category> = Comparator { o1, o2 -> + if (o1.name == "General") return@Comparator -1 + if (o2.name == "General") return@Comparator 1 + else compareValuesBy(o1, o2) { + it.name + } + } + } +}
\ No newline at end of file |
