diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
12 files changed, 40 insertions, 35 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt index 72b28d013..54dc6bed0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneChatMessageHider { + private val config get() = SkyHanniMod.feature.chat private var hideArachneDeadMessage = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 2c0437e01..fdeeb25e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern class ChatFilter { + private val config get() = SkyHanniMod.feature.chat.filterType /// <editor-fold desc="Regex Patterns & Messages"> @@ -97,13 +98,13 @@ class ChatFilter { "§7Putting item in escrow...", "§7Putting coins in escrow...", - //Auction House + // Auction House "§7Setting up the auction...", "§7Processing purchase...", "§7Processing bid...", "§7Claiming BIN auction...", - //Bazaar + // Bazaar "§6[Bazaar] §r§7Submitting sell offer...", "§6[Bazaar] §r§7Submitting buy order...", "§6[Bazaar] §r§7Executing instant sell...", @@ -112,18 +113,18 @@ class ChatFilter { "§6[Bazaar] §r§7Claiming order...", "§6[Bazaar] §r§7Putting goods in escrow...", - //Bank + // Bank "§8Depositing coins...", "§8Withdrawing coins..." ) // Slayer private val slayerPatterns = listOf( - //start + // start " {2}§r§5§lSLAYER QUEST STARTED!".toPattern(), " {3}§5§l» §7Slay §c(.*) Combat XP §7worth of (.*)§7.".toPattern(), - //end + // end " {2}§r§a§lSLAYER QUEST COMPLETE!".toPattern(), " {3}§r§e(.*)Slayer LVL 9 §r§5- §r§a§lLVL MAXED OUT!".toPattern(), " {3}§r§5§l» §r§7Talk to Maddox to claim your (.*) Slayer XP!".toPattern() @@ -137,7 +138,7 @@ class ChatFilter { // Slayer Drop private val slayerDropPatterns = listOf( - //Zombie + // Zombie "§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), @@ -147,7 +148,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§9Undead Catalyst§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§2◆ Pestilence Rune I§r§7\\) §r§b(.*)".toPattern(), - //Tarantula + // Tarantula "§6§lRARE DROP! §r§9Arachne's Keeper Fragment (.+)".toPattern(), "§6§lRARE DROP! §r§5Travel Scroll to Spider's Den Top of Nest (.+)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§a◆ Bite Rune I§r§7\\) (.+)".toPattern(), @@ -155,7 +156,7 @@ class ChatFilter { "§b§lRARE DROP! §r§7\\(§r§f§r§aToxic Arrow Poison§r§7\\) (.+)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§9Bane of Arthropods VI§r§7\\) (.+)".toPattern(), - //Enderman + // Enderman "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§aTwilight Arrow Poison§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§fMana Steal I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5Sinful Dice§r§7\\) (.*)".toPattern(), @@ -167,7 +168,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5◆ End Rune I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§6Hazmat Enderman§r§7\\) .*".toPattern(), - //Blaze + // Blaze "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§fWisp's Ice-Flavored Water I Splash Potion§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§5Bundle of Magma Arrows§r§7\\) (.*)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§7\\d+x §r§f§r§9(Glowstone|Blaze Rod|Magma Cream|Nether Wart) Distillate§r§7\\) (.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt index b9a9a6e0b..e40854c9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils @@ -15,6 +16,7 @@ import net.minecraft.util.IChatComponent import org.lwjgl.input.Mouse class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult>) : GuiScreen() { + private var scroll = -1.0 private val w = 500 private var wasMouseButtonDown = false @@ -61,11 +63,11 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult if (mouseX in 0..w && mouseY in 0..(size * 10) && (isMouseButtonDown && !wasMouseButtonDown)) { if (KeyboardManager.isShiftKeyDown()) { OSUtils.copyToClipboard(IChatComponent.Serializer.componentToJson(msg.message)) - LorenzUtils.chat("Copied structured chat line to clipboard", false) + ChatUtils.chat("Copied structured chat line to clipboard", false) } else { val message = LorenzUtils.stripVanillaMessage(msg.message.formattedText) OSUtils.copyToClipboard(message) - LorenzUtils.chat("Copied chat line to clipboard", false) + ChatUtils.chat("Copied chat line to clipboard", false) } } mouseY -= size * 10 @@ -112,10 +114,8 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult return modifiedSplitText.size } - override fun handleMouseInput() { super.handleMouseInput() setScroll(scroll - Mouse.getEventDWheel()) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt index 5d5580772..2d275d9b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt @@ -2,17 +2,17 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GuiEditManager -import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui +import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.NEUItems import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiEditSign import org.lwjgl.input.Keyboard - object ChatPeek { + @JvmStatic fun peek(): Boolean { val key = SkyHanniMod.feature.chat.peekChat @@ -27,4 +27,4 @@ object ChatPeek { return key.isKeyHeld() } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt index 1399ae216..b4b8b10eb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -67,13 +68,12 @@ class CompactBestiaryChatMessage { val list = bestiaryDescription.map { it.replace("§f", "").trim() } val title = list[1] - LorenzUtils.hoverableChat("§6§lBESTIARY §r$title", list.dropLast(1), command, false) + ChatUtils.hoverableChat("§6§lBESTIARY §r$title", list.dropLast(1), command, false) bestiaryDescription.clear() acceptMoreDescription = true - } else { milestoneMessage?.let { - LorenzUtils.chat("§6§lBESTIARY MILESTONE $it", false) + ChatUtils.chat("§6§lBESTIARY MILESTONE $it", false) milestoneMessage = null } milestonePattern.matchEntire(message)?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt index 4cd9e757d..8b4762948 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName @@ -9,6 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactSplashPotionMessage { + private val config get() = SkyHanniMod.feature.chat.compactPotionMessages private val potionEffectPatternList = listOf( @@ -32,14 +34,14 @@ class CompactSplashPotionMessage { private fun sendMessage(message: String) { if (config.clickableChatMessage) { - LorenzUtils.hoverableChat( + ChatUtils.hoverableChat( message, listOf("§eClick to view your potion effects."), "/effects", prefix = false ) } else { - LorenzUtils.chat(message, prefix = false) + ChatUtils.chat(message, prefix = false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index 0c20c849f..3f0c4b700 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils @@ -43,7 +44,7 @@ class PlayerDeathMessages { val reason = group("reason").removeColor() val color = SkyHanniMod.feature.markedPlayers.chatColor.getChatColor() - LorenzUtils.chat(" §c☠ $color$name §7$reason", false) + ChatUtils.chat(" §c☠ $color$name §7$reason", false) event.blockedReason = "marked_player_death" return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt index a4b7604ce..8859220ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ActionBarStatsData import at.hannibal2.skyhanni.events.ActionBarValueUpdate -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyblockXPInChat { @@ -14,6 +14,6 @@ class SkyblockXPInChat { fun onActionBarValueUpdate(event: ActionBarValueUpdate) { if (event.updated != ActionBarStatsData.SKYBLOCK_XP) return if (!config) return - LorenzUtils.chat(event.updated.value) + ChatUtils.chat(event.updated.value) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt index 3cc67e617..01d893467 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.SkyHanniMod.Companion.coroutineScope import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.APIUtil -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.getPlayerNameFromChatMessage import com.google.gson.JsonArray @@ -20,6 +20,7 @@ import java.net.URLDecoder import java.net.URLEncoder class Translator { + private val messageContentRegex = Regex(".*: (.*)") // Logic for listening for a user click on a chat message is from NotEnoughUpdates @@ -54,8 +55,8 @@ class Translator { return style } - companion object { + private val config get() = SkyHanniMod.feature.chat /* @@ -144,15 +145,15 @@ class Translator { coroutineScope.launch { val translation = getTranslationToEnglish(message) - if (translation == "Unable to translate!") LorenzUtils.userError("Unable to translate message :( (is it in English?)") - else LorenzUtils.chat("Found translation: §f$translation") + if (translation == "Unable to translate!") ChatUtils.userError("Unable to translate message :( (is it in English?)") + else ChatUtils.chat("Found translation: §f$translation") } } fun fromEnglish(args: Array<String>) { if (!isEnabled()) return if (args.size < 2 || args[0].length != 2) { // args[0] is the language code - LorenzUtils.userError("Usage: /shcopytranslation <two letter language code (at the end of a translation)> <message>") + ChatUtils.userError("Usage: /shcopytranslation <two letter language code (at the end of a translation)> <message>") return } val language = args[0] @@ -163,7 +164,7 @@ class Translator { coroutineScope.launch { val translation = getTranslationFromEnglish(message, language) - LorenzUtils.chat("Copied translation to clipboard: $translation") + ChatUtils.chat("Copied translation to clipboard: $translation") OSUtils.copyToClipboard(translation) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index f70c10ea0..11e51e686 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -47,6 +47,7 @@ class WatchdogHider { } companion object { + private const val watchdogStartLine = "§f" private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" private const val watchdogEndLine = "§c" diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt index 4a80f8084..024835aeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.chat.playerchat +import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.MultiFilter -import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatFilter { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index c95763adf..a9c302021 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -69,7 +69,7 @@ class PlayerChatModifier { // TODO remove workaround if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) { - //all players same color in chat + // all players same color in chat string = string.replace("§r§7: ", "§r§f: ") } } @@ -93,6 +93,4 @@ class PlayerChatModifier { event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") } - - } |
