aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-10 20:54:07 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-10 20:54:07 +0200
commit28bc87528709c76d85d90c065d428ef9c31d2bbb (patch)
treed18746aadaa1f51e030ec8faece8766a84297d7a /src/main/java/at/hannibal2/skyhanni
parentbc33d91ec58ecd4dd782485c48385dfad79522c2 (diff)
downloadskyhanni-28bc87528709c76d85d90c065d428ef9c31d2bbb.tar.gz
skyhanni-28bc87528709c76d85d90c065d428ef9c31d2bbb.tar.bz2
skyhanni-28bc87528709c76d85d90c065d428ef9c31d2bbb.zip
Hide own player name or hypixel watchdog player names from visitor detection
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
5 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
index 8b696ad61..bb3be6d0d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
@@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
-import net.minecraft.client.Minecraft
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -25,7 +24,7 @@ class DungeonCopilot {
changeNextStep("Ready up")
}
if (message.endsWith("§a is now ready!")) {
- var name = Minecraft.getMinecraft().thePlayer.name
+ var name = LorenzUtils.getPlayerName()
if (message.contains(name)) {
changeNextStep("Wait for the dungeon to start!")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index 25495a596..0bc7887e5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -342,6 +342,13 @@ class GardenVisitorFeatures {
if (!name.contains("§")) {
name = "§f$name"
}
+
+ // Hide hypixel watchdog entries
+ if (name.contains("§c") && !name.contains("Spaceman")) continue
+
+ //hide own player name
+ if (name.contains(LorenzUtils.getPlayerUuid())) continue
+
visitorsInTab.add(name)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
index 8a3299561..549ff4511 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
@@ -29,7 +29,7 @@ class MarkedPlayerManager {
val name = displayName.lowercase()
- if (name == Minecraft.getMinecraft().thePlayer.name.lowercase()) {
+ if (name == LorenzUtils.getPlayerName().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
}
@@ -66,7 +66,7 @@ class MarkedPlayerManager {
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
SkyHanniMod.feature.markedPlayers.markOwnName.whenChanged { old, new ->
- val name = Minecraft.getMinecraft().thePlayer.name
+ val name = LorenzUtils.getPlayerName()
if (new) {
if (!playerNamesToMark.contains(name)) {
playerNamesToMark.add(name)
@@ -116,7 +116,7 @@ class MarkedPlayerManager {
markedPlayers.clear()
if (SkyHanniMod.feature.markedPlayers.markOwnName.get()) {
- val name = Minecraft.getMinecraft().thePlayer.name
+ val name = LorenzUtils.getPlayerName()
if (!playerNamesToMark.contains(name)) {
playerNamesToMark.add(name)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
index d80c45974..7b3a5a667 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
@@ -82,7 +82,7 @@ class SummoningMobManager {
val name = it.displayName.unformattedText
val matcher = healthPattern.matcher(name)
if (matcher.matches()) {
- val playerName = Minecraft.getMinecraft().thePlayer.name
+ val playerName = LorenzUtils.getPlayerName()
if (name.contains(playerName)) {
summoningMobNametags.add(it as EntityArmorStand)
if (summoningMobNametags.size == summoningsSpawned) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 5f5f83514..13701a95d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -171,6 +171,8 @@ object LorenzUtils {
fun getPlayerUuid() = Minecraft.getMinecraft().thePlayer.uniqueID.toDashlessUUID()
+ fun getPlayerName() = Minecraft.getMinecraft().thePlayer.name
+
fun <E> MutableList<List<E>>.addAsSingletonList(text: E) {
add(Collections.singletonList(text))
}