if (!activePlayers.contains(p)) return;
else restoreInv(p);
activePlayers.remove(p);
inactivePlayers.add(p);
PlayerKilledEvent pk = null;
if (left) {
msgFall(PrefixType.INFO, "game.playerleavegame","player-"+p.getName() );
} else {
if (mode != GameMode.WAITING && p.getLastDamageCause() != null && p.getLastDamageCause().getCause() != null) {
switch (p.getLastDamageCause().getCause()) {
case ENTITY_ATTACK:
if(p.getLastDamageCause().getEntityType() == EntityType.PLAYER){
Player killer = p.getKiller();
msgFall(PrefixType.INFO, "death."+p.getLastDamageCause().getEntityType(),
"player-"+(SurvivalGames.auth.contains(p.getName()) ? ChatColor.DARK_RED + "" + ChatColor.BOLD : "") + p.getName(),
"killer-"+((killer != null)?(SurvivalGames.auth.contains(killer.getName()) ? ChatColor.DARK_RED + "" + ChatColor.BOLD : "")
+ killer.getName():"Unknown"),
"item-"+((killer!=null)?ItemReader.getFriendlyItemName(killer.getItemInHand().getType()) : "Unknown Item"));
if(killer != null && p != null)
sm.addKill(killer, p, gameID);
pk = new PlayerKilledEvent(p, this, killer, p.getLastDamageCause().getCause());
}
else{
msgFall(PrefixType.INFO, "death."+p.getLastDamageCause().getEntityType(), "player-"
+(SurvivalGames.auth.contains(p.getName()) ? ChatColor.DARK_RED + "" + ChatColor.BOLD : "")
+ p.getName(), "killer-"+p.getLastDamageCause().getEntityType());
pk = new PlayerKilledEvent(p, this, null, p.getLastDamageCause().getCause());
}
break;
default:
msgFall(PrefixType.INFO, "death."+p.getLastDamageCause().getCause().name(),
"player-"+(SurvivalGames.auth.contains(p.getName()) ? ChatColor.DARK_RED + "" + ChatColor.BOLD : "") + p.getName(),
"killer-"+p.getLastDamageCause().getCause());
pk = new PlayerKilledEvent(p, this, null, p.getLastDamageCause().getCause());
break;
}
Bukkit.getServer().getPluginManager().callEvent(pk);