diff options
Diffstat (limited to 'src')
-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) |