private void handlePlayerDeath(Player subject) { EntityDamageEvent cause = subject.getLastDamageCause(); // Increment the PlayerData total death stat PlayerData playerData = this.plugin.getPlayerData(subject.getName(), "MineJMX found a new Player"); playerData.incDeaths(); // Increment the ServerData statistics plugin.serverData.incPlayersKilled(); if (cause instanceof EntityDamageByEntityEvent) { Entity predicate = ((EntityDamageByEntityEvent) cause).getDamager(); if (predicate instanceof Player) { // The player was killed by another player, dick move bro PlayerData killerData = this.plugin.getPlayerData(((Player) predicate).getName(), ""); killerData.incPlayersKilled(); // Increment the victim's PvP death stat playerData.incDeathsByPlayer(); } else { // The player was killed by a mob, increment the NpeData statistics NpeData killerData = this.plugin.getNpeDataByClass(predicate.getClass()); killerData.incPlayersKilled(); // Increment the victim's death by NPE stat playerData.incDeathsByNpe(); } } else if (cause instanceof EntityDamageByBlockEvent) { // as it turns out this is only valid for cacti/lava...it might be // completely obsolete in favor of the following switch statement, // but I'm going to leave it in for the time being just in case playerData.incDeathsByEnvironment(); } else { // drowned, burned, fell, etc...increment the environmental death counter switch (cause.getCause()) { case CONTACT: case DROWNING: case FALL: case FIRE: case FIRE_TICK: case LAVA: case LIGHTNING: playerData.incDeathsByEnvironment(); break; } } }