From f0d44f1756c9223f7de278272c223aa4b7317f6f Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 19 Nov 2020 12:43:31 -0600 Subject: [PATCH] Fixed an issue with incompatible sounds. --- .../com/songoda/epicvouchers/voucher/VoucherExecutor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java b/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java index 1f5ad75..2847148 100644 --- a/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java +++ b/src/main/java/com/songoda/epicvouchers/voucher/VoucherExecutor.java @@ -1,5 +1,6 @@ package com.songoda.epicvouchers.voucher; +import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.utils.TextUtils; import com.songoda.epicvouchers.EpicVouchers; import com.songoda.epicvouchers.events.VoucherRedeemEvent; @@ -142,7 +143,11 @@ public class VoucherExecutor { } if (voucher.getSound() != null && !voucher.getSound().isEmpty()) { - player.playSound(player.getLocation(), Sound.valueOf(voucher.getSound()), Integer.MAX_VALUE, voucher.getSoundPitch()); + try { + CompatibleSound sound = CompatibleSound.valueOf(voucher.getSound()); + sound.play(player, Integer.MAX_VALUE, voucher.getSoundPitch()); + } catch (IllegalArgumentException ignored) { + } } String particle = voucher.getParticle();