Skip to content

Commit

Permalink
popup bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Oct 7, 2024
1 parent ce53038 commit 6465e9b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions dist/src/main/kotlin/kr/toxicity/hud/popup/PopupImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,8 @@ class PopupImpl(
init {
val task = task@ { event: UpdateEvent, uuid: UUID ->
PlayerManagerImpl.getHudPlayer(uuid)?.let { hudPlayer ->
if (keyMapping) {
hudPlayer.popupKeyMap[event.key]?.let {
if (it.update()) return@task true
else hudPlayer.popupKeyMap.remove(event.key)
}
}
show(event, hudPlayer)?.let {
if (keyMapping) {
hudPlayer.popupKeyMap[event.key] = it
}
}
show(event, hudPlayer)
}
true
}
section.get("triggers")?.asObject()?.forEachSubConfiguration { _, yamlObject ->
TriggerManagerImpl.getTrigger(yamlObject).registerEvent { t, u ->
Expand Down Expand Up @@ -147,6 +136,19 @@ class PopupImpl(

override fun getMaxStack(): Int = move.locations.size
override fun show(reason: UpdateEvent, hudPlayer: HudPlayer): PopupUpdater? {
if (keyMapping) {
hudPlayer.popupKeyMap[reason.key]?.let {
if (it.update()) return null
else hudPlayer.popupKeyMap.remove(reason.key)
}
}
return show0(reason, hudPlayer)?.apply {
if (keyMapping) {
hudPlayer.popupKeyMap[reason.key] = this
}
}
}
private fun show0(reason: UpdateEvent, hudPlayer: HudPlayer): PopupUpdater? {
val key = reason.key
val get = hudPlayer.popupGroupIteratorMap.computeIfAbsent(group) {
PopupIteratorGroupImpl()
Expand Down

0 comments on commit 6465e9b

Please sign in to comment.