Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void playerDeath(PlayerDeathEvent e) {
- Player killer = e.getEntity().getKiller();
- Player p = e.getEntity();
- int kills = api.getPlayerStats(p).getKills();
- int killerk = api.getPlayerStats(killer.getPlayer()).getKills();
- String name = p.getName();
- if(killer instanceof Player) {
- if(p.getLastDamageCause().getCause() == DamageCause.ENTITY_ATTACK) {
- e.setDeathMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW +
- "was slained by " + ChatColor.RED + killer.getName() + ChatColor.GOLD + "[" + ChatColor.WHITE + killerk + ChatColor.GOLD + "]" + ChatColor.YELLOW + ".");
- return;
- }
- } else {
- if(p.getLastDamageCause().getCause() == DamageCause.FALL) {
- Bukkit.broadcastMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW +
- "hit the ground too hard.");
- return;
- } else if(p.getLastDamageCause().getCause() == DamageCause.DROWNING) {
- Bukkit.broadcastMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW +
- "is drowned.");
- return;
- } else if(p.getLastDamageCause().getCause() == DamageCause.FIRE) {
- Bukkit.broadcastMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW + "is burned to death.");
- return;
- } else if(p.getLastDamageCause().getCause() == DamageCause.FIRE_TICK) {
- Bukkit.broadcastMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW + "is burned to death.");
- return;
- } else if(p.getLastDamageCause().getCause() == DamageCause.LAVA) {
- Bukkit.broadcastMessage(ChatColor.RED + name + ChatColor.GOLD + "[" + ChatColor.WHITE + kills + ChatColor.GOLD + "] " + ChatColor.YELLOW + "tried to swimming in lava.");
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement