diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-04 16:10:20 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-04 16:10:20 +0100 |
| commit | 357f7493e2cadbe8a543710e71e702874e16df29 (patch) | |
| tree | 7dd7c5f35eb24b0123a723b1739068b443a5f41c /src/main/java/at/hannibal2/skyhanni/features/event | |
| parent | 5a8d02dcd10015f310bab9d18558d2299c856dd1 (diff) | |
| download | skyhanni-357f7493e2cadbe8a543710e71e702874e16df29.tar.gz skyhanni-357f7493e2cadbe8a543710e71e702874e16df29.tar.bz2 skyhanni-357f7493e2cadbe8a543710e71e702874e16df29.zip | |
cleanPlayerName respects playerRankHider option now.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt | 5 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt | 39 |
2 files changed, 25 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 01aabed38..14422e6b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -152,7 +152,6 @@ object GriffinBurrowHelper { val playerLocation = LocationUtils.playerLocation() if (config.inquisitorSharing.enabled) { for (inquis in InquisitorWaypointShare.waypoints.values) { - val playerName = inquis.fromPlayer val location = inquis.location event.drawColor(location, LorenzColor.LIGHT_PURPLE) val distance = location.distance(playerLocation) @@ -163,9 +162,9 @@ object GriffinBurrowHelper { event.drawDynamicText(location.add(y = 1), "§d§lInquisitor", 1.7) } if (distance < 5) { - InquisitorWaypointShare.maybeRemove(playerName) + InquisitorWaypointShare.maybeRemove(inquis) } - event.drawDynamicText(location.add(y = 1), "§eFrom §b$playerName", 1.6, yOff = 9f) + event.drawDynamicText(location.add(y = 1), "§eFrom §b${inquis.displayName}", 1.6, yOff = 9f) if (config.inquisitorSharing.showDespawnTime) { val spawnTime = inquis.spawnTime diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index a99be4102..5532d70e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.event.diana - import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -47,7 +46,12 @@ object InquisitorWaypointShare { var waypoints = mapOf<String, SharedInquisitor>() - class SharedInquisitor(val fromPlayer: String, val location: LorenzVec, val spawnTime: SimpleTimeMark) + class SharedInquisitor( + val fromPlayer: String, + val displayName: String, + val location: LorenzVec, + val spawnTime: SimpleTimeMark + ) private var test = false @@ -221,22 +225,23 @@ object InquisitorWaypointShare { if (packet.type.toInt() != 0) return partyPattern.matchMatcher(message) { - val playerName = group("playerName") + val rawName = group("playerName") val x = group("x").trim().toInt() val y = group("y").trim().toInt() val z = group("z").trim().toInt() val location = LorenzVec(x, y, z) - val cleanName = playerName.cleanPlayerName() - if (!waypoints.containsKey(cleanName)) { - LorenzUtils.chat("$playerName §l§efound an inquisitor at §l§c$x $y $z!") - if (cleanName != LorenzUtils.getPlayerName()) { - LorenzUtils.sendTitle("§dINQUISITOR §efrom §b$cleanName", 5.seconds) + val name = rawName.cleanPlayerName() + val displayName = rawName.cleanPlayerName(displayName = true) + if (!waypoints.containsKey(name)) { + LorenzUtils.chat("$displayName §l§efound an inquisitor at §l§c$x $y $z!") + if (name != LorenzUtils.getPlayerName()) { + LorenzUtils.sendTitle("§dINQUISITOR §efrom §b$displayName", 5.seconds) SoundUtils.playBeepSound() } } - val inquis = SharedInquisitor(cleanName, location, SimpleTimeMark.now()) - waypoints = waypoints.editCopy { this[cleanName] = inquis } + val inquis = SharedInquisitor(name, displayName, location, SimpleTimeMark.now()) + waypoints = waypoints.editCopy { this[name] = inquis } if (config.focusInquisitor) { GriffinBurrowHelper.setTargetLocation(location.add(y = 1)) GriffinBurrowHelper.animationLocation = LocationUtils.playerLocation() @@ -245,18 +250,20 @@ object InquisitorWaypointShare { event.isCanceled = true } diedPattern.matchMatcher(message) { - val playerName = group("playerName").cleanPlayerName() - waypoints = waypoints.editCopy { remove(playerName) } - logger.log("Inquisitor died from '$playerName'") + val rawName = group("playerName") + val name = rawName.cleanPlayerName() + val displayName = rawName.cleanPlayerName(displayName = true) + waypoints = waypoints.editCopy { remove(name) } + logger.log("Inquisitor died from '$displayName'") } } fun isEnabled() = DianaAPI.featuresEnabled() && config.enabled - fun maybeRemove(playerName: String) { + fun maybeRemove(inquis: SharedInquisitor) { if (inquisitorsNearby.isEmpty()) { - waypoints = waypoints.editCopy { remove(playerName) } - LorenzUtils.chat("Inquisitor from $playerName not found, deleting.") + waypoints = waypoints.editCopy { remove(inquis.fromPlayer) } + LorenzUtils.chat("Inquisitor from ${inquis.displayName} not found, deleting.") } } } |
