Skip to content

Commit

Permalink
patch sub-case of playsound for 1.16 and 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 16, 2022
1 parent 6cb38c6 commit a1e9cff
Showing 1 changed file with 8 additions and 1 deletion.
@@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit a1e9cff

Please sign in to comment.