diff options
author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-09-09 05:44:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-09 11:44:30 +0200 |
commit | 31134aabbf803ac8f3caf0bff98b12eef8821bc9 (patch) | |
tree | 644ed33553e3a2450b0c4c0f5f03510f910abaa4 /src/main | |
parent | 6b31a0143364c11aada80f511413eb87e0ec7b92 (diff) | |
download | skyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.tar.gz skyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.tar.bz2 skyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.zip |
Fix: Sound Utils Over-correction (#2482)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt index f001cfadb..c05b30549 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt @@ -20,7 +20,6 @@ object SoundUtils { fun ISound.playSound() { DelayedRun.onThread.execute { - if (Minecraft.getMinecraft().soundHandler.isSoundPlaying(this)) return@execute val gameSettings = Minecraft.getMinecraft().gameSettings val oldLevel = gameSettings.getSoundLevel(SoundCategory.PLAYERS) if (!SkyHanniMod.feature.misc.maintainGameVolume) { @@ -28,19 +27,11 @@ object SoundUtils { } try { Minecraft.getMinecraft().soundHandler.playSound(this) + } catch (e: IllegalArgumentException) { + if (e.message?.startsWith("value already present:") == true) return@execute + ErrorManager.logErrorWithData(e, "Failed to play a sound", "soundLocation" to this.soundLocation) } catch (e: Exception) { - if (e is IllegalArgumentException) { - e.message?.let { - if (it.startsWith("value already present:")) { - println("SkyHanni Sound error: $it") - return@execute - } - } - } - ErrorManager.logErrorWithData( - e, "Failed to play a sound", - "soundLocation" to this.soundLocation, - ) + ErrorManager.logErrorWithData(e, "Failed to play a sound", "soundLocation" to this.soundLocation) } finally { if (!SkyHanniMod.feature.misc.maintainGameVolume) { gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel) |