aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-20 12:18:38 +0200
committerGitHub <noreply@github.com>2024-05-20 12:18:38 +0200
commit9d82aa34aab011a538c96418ca7317c2554427d9 (patch)
treeed37cb219288cbed7a46f786e1343de3b0951f36 /src/main/java/at
parent0eebe1c0f734379e50c641aea87fc03a1930d58e (diff)
downloadskyhanni-9d82aa34aab011a538c96418ca7317c2554427d9.tar.gz
skyhanni-9d82aa34aab011a538c96418ca7317c2554427d9.tar.bz2
skyhanni-9d82aa34aab011a538c96418ca7317c2554427d9.zip
Fix: Memory leaks (#1839)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt6
2 files changed, 13 insertions, 0 deletions
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?) {