mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-19 14:01:20 +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.
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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) {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user