Advertisement
LielAmar

Untitled

Jan 16th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package net.PlayIL.duels.listeners;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.entity.PlayerDeathEvent;
  9. import org.bukkit.potion.PotionEffect;
  10.  
  11. import net.PlayIL.duels.Main;
  12. import net.PlayIL.duels.utils.Methods;
  13.  
  14. public class OnPlayerDeath implements Listener {
  15.  
  16. @EventHandler
  17. public void onDeath(PlayerDeathEvent e) {
  18. Player p = e.getEntity();
  19. Player killer = null;
  20. if(Main.lastDamager.containsKey(p.getUniqueId()))
  21. killer = Bukkit.getPlayer(Main.lastDamager.get(p.getUniqueId()));
  22.  
  23. e.setDeathMessage(null);
  24.  
  25. for(PotionEffect pt : p.getActivePotionEffects()) {
  26. p.removePotionEffect(pt.getType());
  27. }
  28.  
  29. if(Main.mapNumber.containsKey(p.getUniqueId())) {
  30. Main.maps[Main.mapNumber.get(p.getUniqueId())] = true;
  31. }
  32.  
  33. e.getDrops().clear();
  34. e.setDroppedExp(0);
  35.  
  36. Methods.spawnMethod(p);
  37. Methods.spawnMethod(killer);
  38.  
  39. p.sendMessage(ChatColor.RED + "You have lost this match against " + killer.getName());
  40. killer.sendMessage(ChatColor.GREEN + "You have won this match against " + p.getName());
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement