aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/chat
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-01-03 11:12:54 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-01-03 11:12:54 +0700
commit487709996c22fb0dbcac792076be799a09865600 (patch)
tree5ab6f27a54d673fb057fd3eafd9a5e27816f898c /src/main/kotlin/cc/woverflow/chatting/chat
parentdf895d122a8a2ea249e686578e026c1d0a8b8c47 (diff)
downloadChatting-487709996c22fb0dbcac792076be799a09865600.tar.gz
Chatting-487709996c22fb0dbcac792076be799a09865600.tar.bz2
Chatting-487709996c22fb0dbcac792076be799a09865600.zip
Chattils -> Chatting (1.1.0)
Update images (ty Mo2men) update screenshot line tooltip (ty Mo2men)
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/chat')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatRegexes.kt11
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt47
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt66
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt88
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt174
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatTabsJson.kt11
6 files changed, 397 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatRegexes.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatRegexes.kt
new file mode 100644
index 0000000..a0a8e86
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatRegexes.kt
@@ -0,0 +1,11 @@
+package cc.woverflow.chatting.chat
+
+data class ChatRegexes(val regexList: List<String>?) {
+ val compiledRegexList: MutableList<Regex> = arrayListOf()
+
+ init {
+ regexList?.forEach {
+ compiledRegexList.add(Regex(it))
+ }
+ }
+}
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt
new file mode 100644
index 0000000..1e08719
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatSearchingManager.kt
@@ -0,0 +1,47 @@
+package cc.woverflow.chatting.chat
+
+import cc.woverflow.chatting.hook.GuiNewChatHook
+import gg.essential.lib.caffeine.cache.Cache
+import gg.essential.lib.caffeine.cache.Caffeine
+import gg.essential.universal.wrappers.message.UTextComponent
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.ChatLine
+import java.util.concurrent.LinkedBlockingQueue
+import java.util.concurrent.ThreadPoolExecutor
+import java.util.concurrent.TimeUnit
+import java.util.concurrent.atomic.AtomicInteger
+
+object ChatSearchingManager {
+ private var counter: AtomicInteger = AtomicInteger(0)
+ private var POOL: ThreadPoolExecutor = ThreadPoolExecutor(
+ 50, 50,
+ 0L, TimeUnit.SECONDS,
+ LinkedBlockingQueue()
+ ) { r ->
+ Thread(
+ r,
+ "Chat Filter Cache Thread ${counter.incrementAndGet()}"
+ )
+ }
+
+ @JvmStatic
+ val cache: Cache<String, List<ChatLine>> = Caffeine.newBuilder().executor(POOL).maximumSize(5000).build()
+
+ @JvmStatic
+ fun filterMessages(text: String, list: List<ChatLine>): List<ChatLine>? {
+ if (text.isBlank()) return list
+ val cached = cache.getIfPresent(text)
+ return cached ?: run {
+ cache.put(text, list.filter {
+ UTextComponent.stripFormatting(it.chatComponent.unformattedText).lowercase()
+ .contains(text.lowercase())
+ })
+ cache.getIfPresent(text)
+ }
+ }
+
+ @JvmStatic
+ fun setPrevText(text: String) {
+ (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).prevText = text
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
new file mode 100644
index 0000000..f72967f
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
@@ -0,0 +1,66 @@
+package cc.woverflow.chatting.chat
+
+import cc.woverflow.chatting.Chatting
+import cc.woverflow.chatting.utils.ListenableArrayList
+import com.google.gson.JsonObject
+import com.google.gson.JsonParser
+import java.io.File
+
+object ChatShortcuts {
+ private val shortcutsFile = File(Chatting.modDir, "chatshortcuts.json")
+ private val PARSER = JsonParser()
+
+ private var initialized = false
+
+ 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() {
+ if (initialized) {
+ return
+ } else {
+ initialized = true
+ }
+ if (!shortcutsFile.exists()) {
+ shortcutsFile.createNewFile()
+ shortcutsFile.writeText(
+ JsonObject().toString()
+ )
+ } else {
+ val jsonObj = PARSER.parse(shortcutsFile.readText()).asJsonObject
+ for (shortcut in jsonObj.entrySet()) {
+ shortcuts.add(shortcut.key to shortcut.value.asString)
+ }
+ }
+ }
+
+ fun removeShortcut(key: String) {
+ shortcuts.removeIf { it.first == key }
+ val jsonObj = PARSER.parse(shortcutsFile.readText()).asJsonObject
+ jsonObj.remove(key)
+ shortcutsFile.writeText(jsonObj.toString())
+ }
+
+ fun writeShortcut(key: String, value: String) {
+ shortcuts.add(key to value)
+ val jsonObj = PARSER.parse(shortcutsFile.readText()).asJsonObject
+ jsonObj.addProperty(key, value)
+ shortcutsFile.writeText(jsonObj.toString())
+ }
+
+ fun handleSentCommand(command: String): String {
+ shortcuts.forEach {
+ if (command == it.first || (command.startsWith(it.first) && command.substringAfter(it.first)
+ .startsWith(" "))
+ ) {
+ return command.replaceFirst(it.first, it.second)
+ }
+ }
+ return command
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
new file mode 100644
index 0000000..1389233
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
@@ -0,0 +1,88 @@
+package cc.woverflow.chatting.chat
+
+import cc.woverflow.chatting.gui.components.TabButton
+import com.google.gson.annotations.SerializedName
+import kotlinx.coroutines.runBlocking
+import net.minecraft.client.Minecraft
+import net.minecraft.util.EnumChatFormatting
+import net.minecraft.util.IChatComponent
+
+data class ChatTab(
+ val enabled: Boolean,
+ val name: String,
+ val unformatted: Boolean,
+ @SerializedName("starts") val startsWith: List<String>?,
+ val contains: List<String>?,
+ @SerializedName("ends") val endsWith: List<String>?,
+ val equals: List<String>?,
+ @SerializedName("regex") val uncompiledRegex: List<String>?,
+ val prefix: String
+) {
+ lateinit var button: TabButton
+ lateinit var compiledRegex: ChatRegexes
+
+ //Ugly hack to make GSON not make button / regex null
+ fun initialize() {
+ compiledRegex = ChatRegexes(uncompiledRegex)
+ val width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(name)
+ button = TabButton(653452, runBlocking {
+ val returnValue = x - 2
+ x += 6 + width
+ return@runBlocking returnValue
+ }, width + 4, 12, this)
+ }
+
+ fun shouldRender(chatComponent: IChatComponent): Boolean {
+ if (startsWith == null && equals == null && endsWith == null && contains == null && uncompiledRegex == null) {
+ return true
+ }
+ val message =
+ if (unformatted) EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.unformattedText) else chatComponent.formattedText
+ equals?.forEach {
+ if (message == it) {
+ return true
+ }
+ }
+ startsWith?.forEach {
+ if (message.startsWith(it)) {
+ return true
+ }
+ }
+ endsWith?.forEach {
+ if (message.endsWith(it)) {
+ return true
+ }
+ }
+ contains?.forEach {
+ if (message.contains(it)) {
+ return true
+ }
+ }
+ compiledRegex.compiledRegexList.forEach {
+ if (it.matches(message)) {
+ return true
+ }
+ }
+ return false
+ }
+
+ override fun equals(other: Any?): Boolean {
+ return other is ChatTab && name == other.name && startsWith == other.startsWith && contains == other.contains && endsWith == other.endsWith && equals == other.equals && compiledRegex == other.compiledRegex
+ }
+
+ override fun hashCode(): Int {
+ var result = name.hashCode()
+ result = 31 * result + (startsWith?.hashCode() ?: 0)
+ result = 31 * result + (contains?.hashCode() ?: 0)
+ result = 31 * result + (endsWith?.hashCode() ?: 0)
+ result = 31 * result + (equals?.hashCode() ?: 0)
+ result = 31 * result + (uncompiledRegex?.hashCode() ?: 0)
+ result = 31 * result + prefix.hashCode()
+ result = 31 * result + button.hashCode()
+ return result
+ }
+
+ companion object {
+ private var x = 4
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt
new file mode 100644
index 0000000..5525a51
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt
@@ -0,0 +1,174 @@
+package cc.woverflow.chatting.chat
+
+import cc.woverflow.chatting.Chatting
+import com.google.gson.GsonBuilder
+import com.google.gson.JsonArray
+import com.google.gson.JsonObject
+import com.google.gson.JsonParser
+import net.minecraft.client.Minecraft
+import net.minecraft.util.IChatComponent
+import java.io.File
+
+object ChatTabs {
+ private val GSON = GsonBuilder().setPrettyPrinting().create()
+ private val PARSER = JsonParser()
+ val tabs = arrayListOf<ChatTab>()
+ var currentTab: ChatTab? = null
+ set(value) {
+ if (value != null) {
+ field = value
+ if (Minecraft.getMinecraft().theWorld != null) {
+ Minecraft.getMinecraft().ingameGUI.chatGUI.refreshChat()
+ }
+ }
+ }
+ private var initialized = false
+
+ private val tabFile = File(Chatting.modDir, "chattabs.json")
+
+ fun initialize() {
+ if (initialized) {
+ return
+ } else {
+ initialized = true
+ }
+ if (!tabFile.exists()) {
+ generateNewFile()
+ } else {
+ try {
+ val chatTabJson = GSON.fromJson(tabFile.readText(), ChatTabsJson::class.java)
+ if (chatTabJson.version == 1) {
+ // ver 2 adds `enabled`
+ chatTabJson.tabs.forEach {
+ it.asJsonObject.addProperty("enabled", true)
+ }
+ chatTabJson.version = 2
+ tabFile.writeText(chatTabJson.toString())
+ }
+ chatTabJson.tabs.forEach {
+ val chatTab = GSON.fromJson(it.toString(), ChatTab::class.java)
+ if (chatTab.enabled) {
+ tabs.add(chatTab)
+ }
+ }
+ } catch (e: Throwable) {
+ e.printStackTrace()
+ tabFile.delete()
+ generateNewFile()
+ }
+ }
+ tabs.forEach {
+ it.initialize()
+ }
+ currentTab = tabs[0]
+ }
+
+ fun shouldRender(message: IChatComponent): Boolean {
+ return currentTab?.shouldRender(message) ?: true
+ }
+
+ private fun generateNewFile() {
+ tabFile.createNewFile()
+ val jsonObject = JsonObject()
+ val defaultTabs = generateDefaultTabs()
+ jsonObject.add("tabs", defaultTabs)
+ jsonObject.addProperty("version", 1)
+ tabFile.writeText(jsonObject.toString())
+ }
+
+ private fun generateDefaultTabs(): JsonArray {
+ val all = ChatTab(true, "ALL", false, null, null, null, null, null, "")
+ val party = ChatTab(
+ true,
+ "PARTY",
+ false,
+ listOf("§r§9Party §8> ", "§r§9P §8> ", "§eThe party was transferred to §r", "§eKicked §r"),
+ null,
+ listOf(
+ "§r§ehas invited you to join their party!",
+ "§r§eto the party! They have §r§c60 §r§eseconds to accept.§r",
+ "§r§ehas disbanded the party!§r",
+ "§r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before they are removed from the party.§r",
+ " §r§ejoined the party.§r",
+ " §r§ehas left the party.§r",
+ " §r§ehas been removed from the party.§r",
+ "§r§e because they were offline.§r"
+ ),
+ listOf("§cThe party was disbanded because all invites expired and the party was empty§r"),
+ listOf( //regexes from https://github.com/kwevin/Hychat-Tabs/blob/main/tabs/re-add%20prefixes%20%26%20fix%20shortened%20tags/chat.json cause i cant write regex
+ "(§r)*(§9Party §8\u003e)+(.*)",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§einvited §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto the party! They have §r§c60 §r§eseconds to accept\\.§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas left the party\\.§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ejoined the party\\.§r",
+ "§eYou left the party\\.§r",
+ "§eYou have joined §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)\u0027s §r§eparty!§r",
+ "§cThe party was disbanded because all invites expired and the party was empty§r",
+ "§cYou cannot invite that player since they\u0027re not online\\.§r",
+ "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e, warped you to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e\u0027s house\\.§r",
+ "§eSkyBlock Party Warp §r§7\\([0-9]+ players?\\)§r",
+ "§a. §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§f §r§awarped to your server§r",
+ "§eYou summoned §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§f §r§eto your server\\.§r",
+ "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e, warped you to their house\\.§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§aenabled Private Game§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§cdisabled Private Game§r",
+ "§cThe party is now muted\\. §r",
+ "§aThe party is no longer muted\\.§r",
+ "§cThere are no offline players to remove\\.§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas been removed from the party\\.§r",
+ "§eThe party was transferred to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eby §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has promoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Leader§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has promoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Moderator§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eis now a Party Moderator§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has demoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Member§r",
+ "§cYou can\u0027t demote yourself!§r",
+ "§6Party Members \\([0-9]+\\)§r",
+ "§eParty Leader: §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) ?§r(?:§[a-zA-Z0-9]).§r",
+ "§eParty Members: §r(?:(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r(?:§[a-zA-Z0-9]) . §r)+",
+ "§eParty Moderators: §r(?:(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r(?:§[a-zA-Z0-9]) . §r)+",
+ "§eThe party invite to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas expired§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§cdisabled All Invite§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§aenabled All Invite§r",
+ "§cYou cannot invite that player\\.§r",
+ "§cYou are not allowed to invite players\\.§r",
+ "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before the party is disbanded\\.§r",
+ "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before they are removed from the party.§r",
+ "§cYou are not in a party right now\\.§r",
+ "§cThis party is currently muted\\.§r",
+ "(§r)*(§9P §8\u003e)+(.*)"
+ ),
+ "/pc "
+ )
+ val guild = ChatTab(
+ true,
+ "GUILD",
+ true,
+ listOf("Guild >", "G >"),
+ null,
+ null,
+ null,
+ null,
+ "/gc "
+ )
+ val pm = ChatTab(
+ true,
+ "PM",
+ true,
+ listOf("To ", "From "),
+ null,
+ null,
+ null,
+ null,
+ "/r "
+ )
+ tabs.add(all)
+ tabs.add(party)
+ tabs.add(guild)
+ tabs.add(pm)
+ val jsonArray = JsonArray()
+ jsonArray.add(PARSER.parse(GSON.toJson(all)).asJsonObject)
+ jsonArray.add(PARSER.parse(GSON.toJson(party)).asJsonObject)
+ jsonArray.add(PARSER.parse(GSON.toJson(guild)).asJsonObject)
+ jsonArray.add(PARSER.parse(GSON.toJson(pm)).asJsonObject)
+ return jsonArray
+ }
+}
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabsJson.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabsJson.kt
new file mode 100644
index 0000000..e37ef7f
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabsJson.kt
@@ -0,0 +1,11 @@
+package cc.woverflow.chatting.chat
+
+import com.google.gson.JsonArray
+import com.google.gson.annotations.SerializedName
+
+data class ChatTabsJson(@SerializedName("tabs") val tabs: JsonArray, @SerializedName("version") var version: Int) {
+
+ override fun toString(): String {
+ return "{\"tabs\": $tabs, \"version\": \"$version\"}"
+ }
+} \ No newline at end of file