Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Hide Other Players in Dance Room Helper not updating if disabled #3413

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.jsonobjects.repo.DanceRoomInstructionsJson
import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
Expand Down Expand Up @@ -86,9 +87,9 @@ object DanceRoomHelper {
} + this@addColor
}

@HandleEvent
@HandleEvent(onlyOnIsland = IslandType.THE_RIFT)
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return
if (!config.enabled) return
if (!inRoom) return
config.position.renderStrings(
display,
Expand All @@ -102,20 +103,21 @@ object DanceRoomHelper {
inRoom = false
}

@HandleEvent
@HandleEvent(onlyOnIsland = IslandType.THE_RIFT)
fun onTick(event: SkyHanniTickEvent) {
if (!isEnabled()) return
// We want this to run even if not enabled, so that the Hide Other Players feature
// properly updates without the helper being enabled
if (event.isMod(10)) {
inRoom = danceRoom.isPlayerInside()
inRoom = RiftApi.inMirrorVerse && danceRoom.isPlayerInside()
}
if (inRoom) {
update()
}
}

@HandleEvent
@HandleEvent(onlyOnIsland = IslandType.THE_RIFT)
fun onPlaySound(event: PlaySoundEvent) {
if (!isEnabled() || !inRoom) return
if (!config.enabled || !inRoom) return
if ((event.soundName == "random.burp" && event.volume == 0.8f) ||
(event.soundName == "random.levelup" && event.pitch == 1.8412699f && event.volume == 1.0f)
) {
Expand All @@ -131,9 +133,9 @@ object DanceRoomHelper {
}
}

@HandleEvent
@HandleEvent(onlyOnIsland = IslandType.THE_RIFT)
fun onTitleReceived(event: TitleReceivedEvent) {
if (!isEnabled()) return
if (!config.enabled) return
if (config.hideOriginalTitle && inRoom) event.cancel()
}

Expand All @@ -160,7 +162,7 @@ object DanceRoomHelper {

@HandleEvent(onlyOnIsland = IslandType.THE_RIFT)
fun onCheckRender(event: CheckRenderEntityEvent<EntityOtherPlayerMP>) {
if (config.hidePlayers && inRoom) {
if (config.hidePlayers && inRoom && event.entity.isRealPlayer()) {
event.cancel()
}
}
Expand All @@ -180,8 +182,6 @@ object DanceRoomHelper {
}
}

fun isEnabled() = RiftApi.inRift() && config.enabled

@HandleEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(9, "rift.area.mirrorVerseConfig", "rift.area.mirrorverse")
Expand Down
Loading