diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-07 05:09:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-07 05:09:48 +0200 |
| commit | cfeac0b6a71c592b61c53fad192eb22bb24b0f54 (patch) | |
| tree | 2d4cbf11b8f5b93b6d907404399ffcd8ae08e763 /src/main/java/at/hannibal2/skyhanni/features/chat | |
| parent | 5b76d78b62420bfa5c9cca3cb3ebc50a12e812b7 (diff) | |
| download | skyhanni-cfeac0b6a71c592b61c53fad192eb22bb24b0f54.tar.gz skyhanni-cfeac0b6a71c592b61c53fad192eb22bb24b0f54.tar.bz2 skyhanni-cfeac0b6a71c592b61c53fad192eb22bb24b0f54.zip | |
0.7 (#2)
* code cleanup
* Option to hide the Skyblock Level from the chat messages,
Option to change the way the Skyblock Level gets displayed in the chat
* change version to 0.6.1
* add highlight the voidling extremist in pink color
* add highlight corrupted mobs in purple color
* fixed highlight corrupted mobs in purple color in the private island
* another minor fix for highlight corrupted mobs in purple color
* created EntityHealthUpdateEvent and fixing CorruptedMobHighlight
* using EntityHealthUpdateEvent everywhere
* added marking a player with yellow color
* highlight slayer miniboss in blue color
* /copyentities now shows health correctly for every entity
* infer fix
* fixing bazaar message filter
* changelog
* hides the death messages of other players, except for players who are close to the player.
* hiding tip messages
* highlight deathmites in dungeon in red color
* code cleanup
* code cleanup
* hide tnt laying around in dungeon
* fix infer
* remove debug
* Added hide Blessings laying around in dungeon.
Added hide Revive Stones laying around in dungeon.
* Hide Premium Flesh laying around in dungeon.
* edited LorenzTest
* Added dungeon copilot and separate filter for hiding dungeon key and door messages.
* Added hide Journal Entry pages laying around in dungeon.
* Added hide Skeleton Skulls laying around in dungeon.
* credits
* Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull)
* Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull)
* fix wording
* clarification
* small fixes
* Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)
* better/more readability for CopyNearbyEntitiesCommand
* make version 0.7
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
4 files changed, 152 insertions, 18 deletions
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 4dc106249..412114c58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -72,13 +72,13 @@ class ChatFilter { } private fun uselessNotification(message: String): Boolean { - return when { - message == "§eYour previous §r§6Plasmaflux Power Orb §r§ewas removed!" -> true - - message == "§aYou used your §r§6Mining Speed Boost §r§aPickaxe Ability!" -> true - message == "§cYour Mining Speed Boost has expired!" -> true - message == "§a§r§6Mining Speed Boost §r§ais now available!" -> true + if (message.matchRegex("§aYou tipped (\\d) (player|players)!")) return true + return when (message) { + "§eYour previous §r§6Plasmaflux Power Orb §r§ewas removed!" -> true + "§aYou used your §r§6Mining Speed Boost §r§aPickaxe Ability!" -> true + "§cYour Mining Speed Boost has expired!" -> true + "§a§r§6Mining Speed Boost §r§ais now available!" -> true else -> false } } @@ -92,7 +92,7 @@ class ChatFilter { message == "§cPlace a Dungeon weapon or armor piece above the anvil to salvage it!" -> true message == "§cWhoa! Slow down there!" -> true message == "§cWait a moment before confirming!" -> true - message == "§cYou need to be out of combat for 3 seconds before opening the SkyBlock Menu!" -> true//TODO prevent in the future + message == "§cYou cannot open the SkyBlock menu while in combat!" -> true else -> false } @@ -206,21 +206,22 @@ class ChatFilter { private fun bazaarAndAHMiniMessages(message: String): Boolean = when (message) { "§7Putting item in escrow...", - "§7Putting goods in escrow...", "§7Putting coins in escrow...", //Auction House "§7Setting up the auction...", "§7Processing purchase...", - "§7Claiming order...", "§7Processing bid...", "§7Claiming BIN auction...", //Bazaar - "§7Submitting sell offer...", - "§7Submitting buy order...", - "§7Executing instant sell...", - "§7Executing instant buy...", + "§6[Bazaar] §r§7Submitting sell offer...", + "§6[Bazaar] §r§7Submitting buy order...", + "§6[Bazaar] §r§7Executing instant sell...", + "§6[Bazaar] §r§7Executing instant buy...", + "§6[Bazaar] §r§7Cancelling order...", + "§6[Bazaar] §r§7Claiming order...", + "§6[Bazaar] §r§7Putting goods in escrow...", //Bank "§8Depositing coins...", diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt new file mode 100644 index 000000000..0a3ead47d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt @@ -0,0 +1,64 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.regex.Pattern + +class HideFarDeathMessages { + + private var tick = 0 + private val lastTimePlayerSeen = mutableMapOf<String, Long>() + + //§c ☠ §r§7§r§bZeroHazel§r§7 was killed by §r§8§lAshfang§r§7§r§7. + private val pattern = Pattern.compile("§c ☠ §r§7§r§.(.+)§r§7 (.+)") + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + checkOtherPlayers() + } + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + val message = event.message + val matcher = pattern.matcher(message) + if (matcher.matches()) { + val name = matcher.group(1) + if (System.currentTimeMillis() > lastTimePlayerSeen.getOrDefault(name, 0) + 30_000) { + event.blockedReason = "far_away_player_death" + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + HypixelData.skyblock = false + } + + private fun checkOtherPlayers() { + val location = LocationUtils.playerLocation() + for (otherPlayer in Minecraft.getMinecraft().theWorld.loadedEntityList + .filterIsInstance<EntityOtherPlayerMP>() + .filter { it.getLorenzVec().distance(location) < 25 }) { + lastTimePlayerSeen[otherPlayer.name] = System.currentTimeMillis() + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.chat.hideFarDeathMessages && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt index ac6b9fbbe..a96997ba6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt @@ -7,15 +7,18 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern class PlayerChatFilter { private val loggerPlayerChat = LorenzLogger("chat/player") + //§8[§9109§8] §b[MVP§c+§b] 4Apex§f§r§f: omg selling + private val patternSkyBlockLevel = Pattern.compile("§8\\[§(.)(\\d+)§8] (.+)") + @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.isOnHypixel) return - if (!SkyHanniMod.feature.chat.playerMessages) return if (shouldBlock(event.message)) { event.blockedReason = "player_chat" @@ -23,10 +26,19 @@ class PlayerChatFilter { } private fun shouldBlock(originalMessage: String): Boolean { - val split = if (originalMessage.contains("§7§r§7: ")) { - originalMessage.split("§7§r§7: ") - } else if (originalMessage.contains("§f: ")) { - originalMessage.split("§f: ") + //since hypixel sends own chat messages really weird " §r§8[§r§d205§r§8] §r§6[MVP§r§c++§r§6] hannibal2" + var rawMessage = originalMessage.replace("§r", "").trim() + + val matcher = patternSkyBlockLevel.matcher(rawMessage) + if (matcher.matches()) { + SkyBlockLevelChatMessage.setData(matcher.group(2).toInt(), matcher.group(1)) + rawMessage = matcher.group(3) + } + + val split = if (rawMessage.contains("§7§7: ")) { + rawMessage.split("§7§7: ") + } else if (rawMessage.contains("§f: ")) { + rawMessage.split("§f: ") } else { return false } @@ -37,6 +49,14 @@ class PlayerChatFilter { rawName = rawName.substring(channel.originalPrefix.length) val name = grabName(rawName) ?: return false + if (!SkyHanniMod.feature.chat.playerMessagesFormat) { + if (SkyHanniMod.feature.chat.hideSkyblockLevel) { + LorenzUtils.chat(rawMessage) + return true + } + return false + } + val message = split[1] send(channel, name.removeColor(), message.removeColor()) return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt new file mode 100644 index 000000000..deacc0de6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt @@ -0,0 +1,49 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.PlayerSendChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class SkyBlockLevelChatMessage { + + companion object { + var level = -1 + var levelColor = "" + + fun setData(level: Int, levelColor: String) { + this.level = level + this.levelColor = levelColor + } + } + + @SubscribeEvent + fun onChatMessage(event: PlayerSendChatEvent) { + if (level == -1) return + event.cancelledReason = "skyblock level" + + val finalMessage = event.message + val name = event.playerName + val prefix = event.channel.prefix + + if (SkyHanniMod.feature.chat.hideSkyblockLevel) { + LorenzUtils.chat("$prefix §b$name §f$finalMessage") + } else { + + when (SkyHanniMod.feature.chat.skyblockLevelDesign) { + 0 -> { + LorenzUtils.chat("$prefix §8[§${levelColor}${level}§8] §b$name §f$finalMessage") + } + + 1 -> { + LorenzUtils.chat("$prefix §${levelColor}§l${level} §b$name §f$finalMessage") + } + + 2 -> { + LorenzUtils.chat("$prefix §b$name §8[§${levelColor}${level}§8]§f: $finalMessage") + } + } + } + level = -1 + } +}
\ No newline at end of file |
