Fix GodMode not checking permission and using wrong obfuscated CB

method
[suspect
this
check
not being necessary anymore].
This commit is contained in:
asofold 2012-10-24 23:04:38 +02:00
parent 66525d4978
commit affeaecb34
2 changed files with 7 additions and 6 deletions

View File

@ -248,8 +248,11 @@ public class FightListener implements Listener {
* |___/
*/
// Only interested in dying players.
if (event.getEntity() instanceof Player)
godMode.death((Player) event.getEntity());
final Entity entity = event.getEntity();
if (entity instanceof Player){
final Player player = (Player) entity;
if (godMode.isEnabled(player)) godMode.death(player);
}
}
/**

View File

@ -99,20 +99,18 @@ public class GodMode extends Check {
// 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 = ((CraftPlayer) player).getHandle();
// Schedule a task to be executed in roughly 1.5 seconds.
final NoCheatPlus plugin = (NoCheatPlus) Bukkit.getPluginManager().getPlugin("NoCheatPlus");
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
try {
final EntityPlayer entity = ((CraftPlayer) player).getHandle();
// Check again if the player should be dead, and if the game didn't mark him as dead.
if (entity.getHealth() <= 0 && !entity.dead) {
// Artificially "kill" him.
entity.deathTicks = 19;
entity.g();
entity.dead = true;
}
} catch (final Exception e) {}
}