diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-09-24 21:06:20 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-09-24 21:06:20 +0200 |
commit | e26f03b0daf1a8992b77f55fbfb1150919e70e7d (patch) | |
tree | 7a97b07d81305548311bdf67ab1658e8615998de /src | |
parent | 262583b1abec71bcbe16c4cabe1f7fbab9d6bd50 (diff) | |
download | skyhanni-e26f03b0daf1a8992b77f55fbfb1150919e70e7d.tar.gz skyhanni-e26f03b0daf1a8992b77f55fbfb1150919e70e7d.tar.bz2 skyhanni-e26f03b0daf1a8992b77f55fbfb1150919e70e7d.zip |
hiding ChumBucketHider NoSuchElementException error messages, reverting not working set wrapping
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 5f64aba8c..0bb98f8e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -66,7 +66,15 @@ object ChumBucketHider { // Chum Bucket if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity.toSet()) { + val toSet = try { + titleEntity.toSet() + } catch (e: NoSuchElementException) { + // Caught an NoSuchElementException in ChumBucketHider at CheckRenderEntityEvent: null + // We know this happens, but we cant fix it, apparently. + // TODO fix it anyway + return + } + for (title in toSet) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.cancel() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt index 4c4a35151..100bbbd10 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt @@ -27,9 +27,7 @@ class TimeLimitedSet<T : Any>( fun clear() = cache.clear() - fun toSet(): Set<T> = cache.keys().let { keys -> - if (keys.isEmpty()) emptySet() else keys.toSet() - } + fun toSet(): Set<T> = cache.keys().toSet() override fun iterator(): Iterator<T> = toSet().iterator() } |