From 908cd6297c2be25db181ff47ad27549882636af4 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Wed, 5 Jan 2022 14:17:01 -0700 Subject: figuring out api stuff for recent minecraft releases --- .../Resurrection/commands/CommandResurrect.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/net/brysonsteck/Resurrection/commands/CommandResurrect.java') diff --git a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java index a2301b3..a026d31 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java @@ -61,7 +61,12 @@ public class CommandResurrect implements CommandExecutor { resurrectPlayer.removePotionEffect(effect.getType()); resurrectPlayer.setGameMode(GameMode.SURVIVAL); for(Player player : Bukkit.getOnlinePlayers()){ - player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0); + try { + player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0); + } catch (NoSuchFieldError e) { + log.warning("NoSuchFieldError encountered, playing Wither noise instead."); + player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); + } } Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!"); removeDeath(resurrectPlayer); @@ -108,7 +113,12 @@ public class CommandResurrect implements CommandExecutor { resurrectPlayer.removePotionEffect(effect.getType()); resurrectPlayer.setGameMode(GameMode.SURVIVAL); for(Player player : Bukkit.getOnlinePlayers()){ - player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0); + try { + player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0); + } catch (NoSuchFieldError e) { + log.warning("NoSuchFieldError encountered, playing Wither noise instead."); + player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); + } } Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!"); removeDeath(resurrectPlayer); -- cgit v1.2.3