mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-01 05:18:00 +01:00
Fix GodMode not checking permission and using wrong obfuscated CB
method [suspect this check not being necessary anymore].
This commit is contained in:
parent
66525d4978
commit
affeaecb34
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user