aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md20
-rw-r--r--FEATURES.md6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MarkedPlayers.java23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/EntityData.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt)61
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt)30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFormatter.kt)16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/chat/PlayerMessageChannel.kt)2
12 files changed, 153 insertions, 38 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d00d21cf9..c7b8bc478 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,15 +3,17 @@
## Version 0.8.1
### Misc
-- Added hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.
-- Added option to hide all damage splashes, from anywhere in Skyblock.
-- Added highlight Thunder Sparks after killing a Thunder
-- Added Thunder to damage indicator
-- Added option to enable that clicking on a player name in chat opens the profile viewer of NotEnoughUpdates (to fix SkyHanni breaking the default NEU feature).
-- Added support for new SBA chat icon feature (show profile type and faction in chat)
-- Added hide the damage, ability damage and defence orbs that spawn when the healer is killing mobs
-- Added hide the golden fairy that follows the healer in dungeon.
-- Added hidden music for the clean end of the dungeon
++ Added hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.
++ Added option to hide all damage splashes, from anywhere in Skyblock.
++ Added highlight Thunder Sparks after killing a Thunder
++ Added Thunder to damage indicator
++ Added option to enable that clicking on a player name in chat opens the profile viewer of NotEnoughUpdates (to fix SkyHanni breaking the default NEU feature).
++ Added support for new SBA chat icon feature (show profile type and faction in chat)
++ Added hide the damage, ability damage and defence orbs that spawn when the healer is killing mobs
++ Added hide the golden fairy that follows the healer in dungeon.
++ Added hidden music for the clean end of the dungeon
++ Highlight marked player names in chat.
++ Mark the own player name.
### Fixed
- Links in player chat are clickable again
diff --git a/FEATURES.md b/FEATURES.md
index 41a75d926..628561bcc 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -102,6 +102,12 @@
- Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)
- Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.
+## Marked Players
++ Adding or removing players as marked with command /shmarkplayer
++ Highlight marked players in the world.
++ Highlight marked player names in chat.
++ Mark the own player name.
+
## Commands
- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
- /shmarkplayer <player> (marking a player with yellow color)
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index cf310e364..1dd8ad6ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -11,8 +11,8 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi;
import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod;
import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper;
import at.hannibal2.skyhanni.features.chat.ChatFilter;
-import at.hannibal2.skyhanni.features.chat.HideFarDeathMessages;
-import at.hannibal2.skyhanni.features.chat.PlayerChatFormatter;
+import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages;
+import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFormatter;
import at.hannibal2.skyhanni.features.commands.WikiCommand;
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager;
import at.hannibal2.skyhanni.features.dungeon.*;
@@ -119,9 +119,9 @@ public class SkyHanniMod {
registerEvent(new SummoningMobManager());
registerEvent(new VoidlingExtremistColor());
registerEvent(new CorruptedMobHighlight());
- registerEvent(new PlayerMarker());
+ registerEvent(new MarkedPlayerManager());
registerEvent(new HighlightSlayerMiniboss());
- registerEvent(new HideFarDeathMessages());
+ registerEvent(new PlayerDeathMessages());
registerEvent(new HighlightDungeonDeathmite());
registerEvent(new DungeonHideItems());
registerEvent(new DungeonCopilot());
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 70307c9f4..3e5c4af7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -8,7 +8,8 @@ import at.hannibal2.skyhanni.config.core.config.Position;
import at.hannibal2.skyhanni.config.core.config.annotations.Category;
import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor;
import at.hannibal2.skyhanni.config.features.*;
-import at.hannibal2.skyhanni.features.chat.PlayerChatFormatter;
+import at.hannibal2.skyhanni.features.MarkedPlayerManager;
+import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFormatter;
import com.google.gson.annotations.Expose;
import net.minecraft.client.Minecraft;
@@ -95,6 +96,11 @@ public class Features extends Config {
PlayerChatFormatter.Companion.testGuildChat();
return;
}
+
+ if (runnableId.equals("markOwnPlayer")) {
+ MarkedPlayerManager.toggleOwn();
+ return;
+ }
}
@Expose
@@ -146,6 +152,10 @@ public class Features extends Config {
public CommandsFeatures commands = new CommandsFeatures();
@Expose
+ @Category(name = "Marked Players", desc = "Players that got marked with /shmarkplayer")
+ public MarkedPlayers markedPlayers = new MarkedPlayers();
+
+ @Expose
@Category(name = "Misc", desc = "Settings without a category.")
public Misc misc = new Misc();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.java b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.java
index 460de1b7f..275a6eaaf 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.java
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.config.commands;
import at.hannibal2.skyhanni.SkyHanniMod;
import at.hannibal2.skyhanni.config.ConfigEditor;
import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper;
-import at.hannibal2.skyhanni.features.PlayerMarker;
+import at.hannibal2.skyhanni.features.MarkedPlayerManager;
import at.hannibal2.skyhanni.test.LorenzTest;
import at.hannibal2.skyhanni.test.command.CopyItemCommand;
import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand;
@@ -93,7 +93,7 @@ public class Commands {
"shmarkplayer",
new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- PlayerMarker.Companion.command(args);
+ MarkedPlayerManager.Companion.command(args);
}
}
)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MarkedPlayers.java b/src/main/java/at/hannibal2/skyhanni/config/features/MarkedPlayers.java
new file mode 100644
index 000000000..7bff63e95
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MarkedPlayers.java
@@ -0,0 +1,23 @@
+package at.hannibal2.skyhanni.config.features;
+
+import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorBoolean;
+import at.hannibal2.skyhanni.config.core.config.annotations.ConfigOption;
+import com.google.gson.annotations.Expose;
+
+public class MarkedPlayers {
+
+ @Expose
+ @ConfigOption(name = "Highlight in World", desc = "Highlight marked players in the world.")
+ @ConfigEditorBoolean
+ public boolean highlightInWorld = true;
+
+ @Expose
+ @ConfigOption(name = "Highlight in Chat", desc = "Highlight marked player names in chat.")
+ @ConfigEditorBoolean
+ public boolean highlightInChat = true;
+
+ @Expose
+ @ConfigOption(name = "Mark Own Name", desc = "Mark own player name.")
+ @ConfigEditorBoolean(runnableId = "markOwnPlayer")
+ public boolean markOwnName = false;
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt
index 79d0107c7..f306bcdf8 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt
@@ -16,7 +16,7 @@ class EntityData {
if (packet !is S1CPacketEntityMetadata) return
if (packet == null) {
- LorenzUtils.debug("packet is null in CorruptedMobHigh light!")
+ LorenzUtils.debug("packet is null in EntityData!")
return
}
@@ -26,12 +26,12 @@ class EntityData {
val theWorld = Minecraft.getMinecraft().theWorld
if (theWorld == null) {
- LorenzUtils.debug("theWorld is null in CorruptedMobHighlight!")
+ LorenzUtils.debug("theWorld is null in EntityData!")
continue
}
val entityId = packet.entityId
if (entityId == null) {
- LorenzUtils.debug("entityId is null in CorruptedMobHighlight!")
+ LorenzUtils.debug("entityId is null in EntityData!")
continue
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt
index bf392939a..4ed17e749 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.events
-import at.hannibal2.skyhanni.features.chat.PlayerMessageChannel
+import at.hannibal2.skyhanni.features.chat.playerchat.PlayerMessageChannel
+import net.minecraft.util.ChatComponentText
class PlayerSendChatEvent(
val channel: PlayerMessageChannel,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt b/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt
index eac2f2575..48570898d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt
@@ -1,5 +1,7 @@
package at.hannibal2.skyhanni.features
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.PlayerSendChatEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
@@ -7,11 +9,12 @@ import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
+import net.minecraft.util.EnumChatFormatting
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-class PlayerMarker {
+class MarkedPlayerManager {
companion object {
private val playerNamesToMark = mutableListOf<String>()
@@ -25,14 +28,21 @@ class PlayerMarker {
val displayName = args[0]
val name = displayName.lowercase()
+
+
+ if (name == Minecraft.getMinecraft().thePlayer.name.lowercase()) {
+ LorenzUtils.chat("§c[SkyHanni] You can't add or remove yourself this way! Go to the settings and toggle 'Mark your own name'.")
+ return
+ }
+
if (name !in playerNamesToMark) {
playerNamesToMark.add(name)
findPlayers()
- LorenzUtils.chat("§e[SkyHanni] §aMarked §eplayer §b$displayName!")
+ LorenzUtils.chat("§e[SkyHanni] §aMarked §eplayer §b$displayName§e!")
} else {
playerNamesToMark.remove(name)
markedPlayers.remove(name)
- LorenzUtils.chat("§e[SkyHanni] §cUnmarked §eplayer §b$displayName!")
+ LorenzUtils.chat("§e[SkyHanni] §cUnmarked §eplayer §b$displayName§e!")
}
}
@@ -48,13 +58,28 @@ class PlayerMarker {
}
}
}
+
+ fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark
+
+ @JvmStatic
+ fun toggleOwn() {
+ val ownName = SkyHanniMod.feature.markedPlayers.markOwnName
+ val name = Minecraft.getMinecraft().thePlayer.name
+ if (ownName) {
+ if (!playerNamesToMark.contains(name)) {
+ playerNamesToMark.add(name)
+ }
+ } else {
+ playerNamesToMark.remove(name)
+ }
+ }
}
var tick = 0
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
- if (!isEnabled()) return
+ if (!LorenzUtils.inSkyblock) return
if (tick++ % 20 == 0) {
findPlayers()
@@ -63,7 +88,9 @@ class PlayerMarker {
@SubscribeEvent
fun onRenderMobColored(event: RenderMobColoredEvent) {
- if (!isEnabled()) return
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return
+
val entity = event.entity
if (entity in markedPlayers.values) {
event.color = LorenzColor.YELLOW.toColor().withAlpha(127)
@@ -72,7 +99,9 @@ class PlayerMarker {
@SubscribeEvent
fun onResetEntityHurtTime(event: ResetEntityHurtEvent) {
- if (!isEnabled()) return
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return
+
val entity = event.entity
if (entity in markedPlayers.values) {
event.shouldReset = true
@@ -81,10 +110,26 @@ class PlayerMarker {
@SubscribeEvent
fun onWorldChange(event: WorldEvent.Load) {
+ if (Minecraft.getMinecraft().thePlayer == null) return
+
markedPlayers.clear()
+ if (SkyHanniMod.feature.markedPlayers.markOwnName) {
+ val name = Minecraft.getMinecraft().thePlayer.name
+ if (!playerNamesToMark.contains(name)) {
+ playerNamesToMark.add(name)
+ }
+ }
}
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock
+ @SubscribeEvent(receiveCanceled = true)
+ fun onMarkedChatMessage(event: PlayerSendChatEvent) {
+ if (!LorenzUtils.inSkyblock) return
+
+ for (chatComponent in event.chatComponents) {
+ val text = chatComponent.unformattedText
+ if (isMarkedPlayer(text) && SkyHanniMod.feature.markedPlayers.highlightInChat) {
+ chatComponent.chatStyle.color = EnumChatFormatting.YELLOW
+ }
+ }
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
index 0a3ead47d..4e1e26fdb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
@@ -3,8 +3,10 @@ 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.features.MarkedPlayerManager
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
@@ -13,7 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import java.util.regex.Pattern
-class HideFarDeathMessages {
+class PlayerDeathMessages {
private var tick = 0
private val lastTimePlayerSeen = mutableMapOf<String, Long>()
@@ -23,7 +25,7 @@ class HideFarDeathMessages {
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
- if (!isEnabled()) return
+ if (!isHideFarDeathsEnabled()) return
if (tick++ % 20 == 0) {
checkOtherPlayers()
@@ -32,14 +34,30 @@ class HideFarDeathMessages {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
- if (!isEnabled()) return
+ if (!LorenzUtils.inSkyblock) 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"
+ if (SkyHanniMod.feature.markedPlayers.highlightInChat && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight) {
+ if (MarkedPlayerManager.isMarkedPlayer(name)) {
+ val reason = matcher.group(2).removeColor()
+ LorenzUtils.chat(" §c☠ §e$name §7$reason")
+ event.blockedReason = "marked_player_death"
+ return
+ }
+ }
+
+
+ if (isHideFarDeathsEnabled()) {
+ if (System.currentTimeMillis() > lastTimePlayerSeen.getOrDefault(name, 0) + 30_000) {
+ event.blockedReason = "far_away_player_death"
+ }
+ }
+ } else {
+ if (message.contains("☠")) {
+ println("wrong death message: '$message'")
}
}
}
@@ -58,7 +76,7 @@ class HideFarDeathMessages {
}
}
- private fun isEnabled(): Boolean {
+ private fun isHideFarDeathsEnabled(): 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/PlayerChatFormatter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt
index 36a9e057c..39b8458f2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFormatter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt
@@ -1,8 +1,9 @@
-package at.hannibal2.skyhanni.features.chat
+package at.hannibal2.skyhanni.features.chat.playerchat
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PlayerSendChatEvent
+import at.hannibal2.skyhanni.features.MarkedPlayerManager
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -180,10 +181,19 @@ class PlayerChatFormatter {
return cleanName
}
+ val markedPlayer = MarkedPlayerManager.isMarkedPlayer(cleanName) && SkyHanniMod.feature.markedPlayers.highlightInChat
return if (SkyHanniMod.feature.chat.playerRankHider) {
- "§b$cleanName"
+ if (markedPlayer) "§e$cleanName" else "§b$cleanName"
} else {
- rawName
+ if (markedPlayer) {
+ if (rawName.contains(" ")) {
+ rawName[0] + " §e" + cleanName
+ } else {
+ "§e$cleanName"
+ }
+ } else {
+ rawName
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerMessageChannel.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt
index e457bea8f..b75f2c970 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerMessageChannel.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.features.chat
+package at.hannibal2.skyhanni.features.chat.playerchat
enum class PlayerMessageChannel(
val prefixColor: String,