From 31134aabbf803ac8f3caf0bff98b12eef8821bc9 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Mon, 9 Sep 2024 05:44:30 -0400 Subject: Fix: Sound Utils Over-correction (#2482) --- src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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) -- cgit