mirror of
https://github.com/songoda/EpicVouchers.git
synced 2024-11-21 17:45:48 +01:00
fix: Replaces usage of depreacted CompatibleSound with XSound
The CompatibleSound class will be removed from the Core and this ensures compatibility with new versions of the Core and newer Minecraft versions
This commit is contained in:
parent
57746b195c
commit
abb770ef65
@ -1,10 +1,10 @@
|
||||
package com.craftaro.epicvouchers.voucher;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleSound;
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.epicvouchers.EpicVouchers;
|
||||
import com.craftaro.epicvouchers.events.VoucherRedeemEvent;
|
||||
import com.craftaro.epicvouchers.listeners.PlayerCommandListener;
|
||||
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
@ -15,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class VoucherExecutor {
|
||||
@ -142,11 +143,8 @@ public class VoucherExecutor {
|
||||
}
|
||||
|
||||
if (voucher.getSound() != null && !voucher.getSound().isEmpty()) {
|
||||
try {
|
||||
CompatibleSound sound = CompatibleSound.valueOf(voucher.getSound());
|
||||
sound.play(player, Integer.MAX_VALUE, voucher.getSoundPitch());
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
Optional<XSound> sound = XSound.matchXSound(voucher.getSound());
|
||||
sound.ifPresent(xSound -> xSound.play(player, 1.0f, voucher.getSoundPitch()));
|
||||
}
|
||||
|
||||
String particle = voucher.getParticle();
|
||||
|
Loading…
Reference in New Issue
Block a user