From a1e9cff9cae05714a6a09e4a11a033dc21793246 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Thu, 15 Dec 2022 21:11:56 -0800 Subject: [PATCH] patch sub-case of playsound for 1.16 and 1.17 --- .../denizen/scripts/commands/world/PlaySoundCommand.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java index 9364ea6461..8c46c7804f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java @@ -1,5 +1,7 @@ package com.denizenscript.denizen.scripts.commands.world; +import com.denizenscript.denizen.nms.NMSHandler; +import com.denizenscript.denizen.nms.NMSVersion; import com.denizenscript.denizen.objects.LocationTag; import com.denizenscript.denizen.objects.PlayerTag; import com.denizenscript.denizencore.exceptions.InvalidArgumentsException; @@ -153,7 +155,12 @@ else if (locations != null) { player.getPlayerEntity().playSound(player.getLocation(), sound, categoryEnum, volume, pitch); } else { - player.getPlayerEntity().playSound(player.getPlayerEntity(), Sound.valueOf(sound.toUpperCase()), categoryEnum, volume, pitch); + if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_18)) { + player.getPlayerEntity().playSound(player.getPlayerEntity(), Sound.valueOf(sound.toUpperCase()), categoryEnum, volume, pitch); + } + else { + player.getPlayerEntity().playSound(player.getLocation(), Sound.valueOf(sound.toUpperCase()), categoryEnum, volume, pitch); + } } } }