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