From 9d82aa34aab011a538c96418ca7317c2554427d9 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 20 May 2024 12:18:38 +0200 Subject: Fix: Memory leaks (#1839) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt | 7 +++++++ .../skyhanni/features/slayer/blaze/HellionShieldHelper.kt | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt index eab95363b..28b03f597 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -71,6 +72,12 @@ class HideMobNames { } } + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + lastMobName.clear() + mobNamesHidden.clear() + } + private fun shouldNameBeHidden(name: String): Boolean { for (pattern in patterns) { pattern.matchMatcher(name) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt index 24fda1ae8..d501e3f0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,6 +20,11 @@ class HellionShieldHelper { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeColoredMobs", "slayer.blazes.hellion.coloredMobs") } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + hellionShieldMobs.clear() + } } fun EntityLiving.setHellionShield(shield: HellionShield?) { -- cgit