diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-20 16:34:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 16:34:52 +0200 |
commit | f0cd6514fb27b8c09441f1d4999e944822e3c205 (patch) | |
tree | 88c7f0e46f95c678d93dd20a15e4cd7ece67ddcd /src/main/java/at/hannibal2/skyhanni/data | |
parent | 57ba5e53577d0e4a1c244ff3ea86ee188e4b98b5 (diff) | |
download | skyhanni-f0cd6514fb27b8c09441f1d4999e944822e3c205.tar.gz skyhanni-f0cd6514fb27b8c09441f1d4999e944822e3c205.tar.bz2 skyhanni-f0cd6514fb27b8c09441f1d4999e944822e3c205.zip |
Fix: small memory leak (#1848)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/EntityData.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index 8d1b836df..4cc5f840d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.derpy @@ -36,6 +37,13 @@ class EntityData { } @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + if (event.repeatSeconds(30)) { + maxHealthMap.keys.removeIf { it.isDead } + } + } + + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { maxHealthMap.clear() } |