Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Listeners;
- import java.io.File;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.OfflinePlayer;
- import org.bukkit.Server;
- import org.bukkit.Sound;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.craftbukkit.Main;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.player.PlayerRespawnEvent;
- import com.connorlinfoot.bountifulapi.BountifulAPI;
- import main.MainClass;
- public class FinalDeathListener
- implements Listener
- {
- private MainClass plugin;
- public FinalDeathListener(MainClass plugin)
- {
- this.plugin = plugin;
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
- File mapfile = new File("plugins/NextPlugin/Maps", "maps.yml");
- FileConfiguration cfgmap = YamlConfiguration.loadConfiguration(this.mapfile);
- @EventHandler
- public void onDeath (PlayerDeathEvent e) {
- Player p = e.getEntity().getPlayer();
- e.setDeathMessage(null);
- if(plugin.HasBlock.contains(p)) {
- plugin.respawn(p);
- } else if(!plugin.HasBlock.contains(p)) {
- p.setGameMode(GameMode.SPECTATOR);
- plugin.respawn(p);
- p.getInventory().clear();
- BountifulAPI.sendTitle(p,5,10,5,"Ausgeschieden!","");
- p.playSound(p.getLocation(), Sound.BLOCK_PISTON_CONTRACT, 1, 0);
- }
- if (e.getEntity().getKiller() != null) {
- for (Player all : Bukkit.getOnlinePlayers()) {
- if(plugin.HasBlock.contains(p)) {
- all.sendMessage(MainClass.prefix + "§r" + p.getDisplayName() +" §7wurde von §r" + e.getEntity().getKiller().getDisplayName() + " §7getötet");
- } else if(!plugin.HasBlock.contains(p)) {
- all.sendMessage(MainClass.prefix + "§r" + p.getDisplayName() + " §7ist ausgeschieden!");
- if(plugin.TeamBlau.contains(p)) {
- plugin.TeamBlau.remove(p);
- p.sendMessage("jgsfhgsqfs");
- }
- if(plugin.TeamRot.contains(p)) {
- plugin.TeamRot.remove(p);
- }
- }
- }
- } else {
- for (Player all : Bukkit.getOnlinePlayers()) {
- if(plugin.HasBlock.contains(p)) {
- all.sendMessage(MainClass.prefix + "§r" + p.getDisplayName() + " §7ist gestorben");
- } else if(!plugin.HasBlock.contains(p)) {
- all.sendMessage(MainClass.prefix + "§r" + p.getDisplayName() + " §7ist ausgeschieden!");
- if(plugin.TeamBlau.contains(p)) {
- plugin.TeamBlau.remove(p);
- p.sendMessage("jgsfhgsqfs");
- }
- if(plugin.TeamRot.contains(p)) {
- plugin.TeamRot.remove(p);
- }
- }
- }
- }
- if(plugin.TeamBlau.contains(p) && plugin.HasBlock.contains(p)) {
- if(!plugin.HasBlock.contains(p)) {
- p.sendMessage(MainClass.prefix + "§cDu bist aus dieser Runde ausgeschieden!");
- p.setGameMode(GameMode.SPECTATOR);
- p.getInventory().clear();
- p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 2);
- }
- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement