summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt39
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.")
}
}
}