public void death(CraftPlayer player) {
// First check if the player is really dead (e.g. another plugin could
// have just fired an artificial event)
if(player.getHealth() <= 0 && player.isDead()) {
try {
final EntityPlayer entity = player.getHandle();
// Schedule a task to be executed in roughly 1.5 seconds
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
try {
// Check again if the player should be dead, and
// if the game didn't mark him as dead
if(entity.getHealth() <= 0 && !entity.dead) {
// Artifically "kill" him
entity.deathTicks = 19;
entity.a(true);
}
} catch(Exception e) {}
}
}, 30);
} catch(Exception e) {}