added sounds to resurrection event

This commit is contained in:
Bryson Steck 2021-06-15 20:23:28 -06:00
parent a49057361f
commit 55fe6d9001
8 changed files with 25 additions and 15 deletions

View file

@ -14,6 +14,7 @@ public class Resurrection extends JavaPlugin implements Listener {
@Override @Override
public void onDisable() { public void onDisable() {
super.onDisable(); super.onDisable();
System.out.println("[Resurrection] Resurrection has completed shutdown.");
} }
@Override @Override
@ -23,6 +24,7 @@ public class Resurrection extends JavaPlugin implements Listener {
PluginDescriptionFile pluginInfo = getDescription(); PluginDescriptionFile pluginInfo = getDescription();
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
if (pluginInfo.getVersion().contains("beta")) {
// beta message // beta message
System.out.println("[Resurrection] ---------------------------------------------------------"); System.out.println("[Resurrection] ---------------------------------------------------------");
System.out.println("[Resurrection] WARNING!!!!"); System.out.println("[Resurrection] WARNING!!!!");
@ -34,6 +36,7 @@ public class Resurrection extends JavaPlugin implements Listener {
System.out.println("[Resurrection] is up-to-date for more features and bug fixes. The plugin"); System.out.println("[Resurrection] is up-to-date for more features and bug fixes. The plugin");
System.out.println("[Resurrection] will now check for updates."); System.out.println("[Resurrection] will now check for updates.");
System.out.println("[Resurrection] ---------------------------------------------------------"); System.out.println("[Resurrection] ---------------------------------------------------------");
}
// check for updates // check for updates
System.out.println("[Resurrection] Checking for updates..."); System.out.println("[Resurrection] Checking for updates...");

View file

@ -3,6 +3,7 @@ package net.brysonsteck.Resurrection.commands;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -26,6 +27,9 @@ public class CommandResurrect implements CommandExecutor {
for (PotionEffect effect : resurrectPlayer.getActivePotionEffects()) for (PotionEffect effect : resurrectPlayer.getActivePotionEffects())
resurrectPlayer.removePotionEffect(effect.getType()); resurrectPlayer.removePotionEffect(effect.getType());
resurrectPlayer.setGameMode(GameMode.SURVIVAL); resurrectPlayer.setGameMode(GameMode.SURVIVAL);
for(Player player : Bukkit.getOnlinePlayers()){
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
}
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!"); Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!");
return true; return true;
} else { } else {
@ -48,6 +52,9 @@ public class CommandResurrect implements CommandExecutor {
for (PotionEffect effect : resurrectPlayer.getActivePotionEffects()) for (PotionEffect effect : resurrectPlayer.getActivePotionEffects())
resurrectPlayer.removePotionEffect(effect.getType()); resurrectPlayer.removePotionEffect(effect.getType());
resurrectPlayer.setGameMode(GameMode.SURVIVAL); resurrectPlayer.setGameMode(GameMode.SURVIVAL);
for(Player player : Bukkit.getOnlinePlayers()){
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
}
Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!"); Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!");
return true; return true;
} else { } else {

View file

@ -1,10 +1,7 @@
package net.brysonsteck.Resurrection.player; package net.brysonsteck.Resurrection.player;
import net.brysonsteck.Resurrection.Resurrection; import net.brysonsteck.Resurrection.Resurrection;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -40,6 +37,9 @@ public class PlayerListener implements Listener {
for (PotionEffect effect : p.getActivePotionEffects()) for (PotionEffect effect : p.getActivePotionEffects())
p.removePotionEffect(effect.getType()); p.removePotionEffect(effect.getType());
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
for(Player p : Bukkit.getOnlinePlayers()){
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
}
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!"); Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
} }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1728000); }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1728000);