Use player.getHealth() instead of player.isDead() because the latter

is broken in MC 1.0.0
This commit is contained in:
Evenprime 2011-11-24 22:06:26 +01:00
parent 7af72125aa
commit f3663d07aa
5 changed files with 14 additions and 6 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cc.co.evenprime.bukkit</groupId>
<artifactId>NoCheat</artifactId>
<version>2.17a</version>
<version>2.17b</version>
<packaging>jar</packaging>
<name>NoCheat</name>
<properties>

View File

@ -15,6 +15,8 @@ public interface NoCheatPlayer {
public BaseData getData();
public boolean isDead();
public boolean isSprinting();
public int getTicksLived();

View File

@ -20,8 +20,10 @@ public class GodmodeCheck extends TimedCheck {
public void check(NoCheatPlayer player, TimedData data, CCTimed cc) {
// server lag(ged), skip this, or player dead, therefore it's reasonable
// for him to not move :)
if(plugin.skipCheck() || player.getPlayer().isDead())
if(plugin.skipCheck() || player.isDead()) {
data.ticksBehind = 0;
return;
}
final int ticksLived = player.getTicksLived();

View File

@ -104,13 +104,14 @@ public class MovingEventManager extends EventManagerImpl {
@Override
protected void handlePlayerMoveEvent(final PlayerMoveEvent event, final Priority priority) {
// Not interested at all in players in vehicles
if(event.getPlayer().isInsideVehicle()) {
// Get the world-specific configuration that applies here
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
// Not interested at all in players in vehicles or dead
if(event.getPlayer().isInsideVehicle() || player.isDead()) {
return;
}
// Get the world-specific configuration that applies here
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final CCMoving cc = player.getConfiguration().moving;
if(!cc.check || player.hasPermission(Permissions.MOVING)) {

View File

@ -37,6 +37,9 @@ public class NoCheatPlayerImpl implements NoCheatPlayer {
this.player = player;
}
public boolean isDead() {
return this.player.getHealth() <= 0 || this.player.isDead();
}
public boolean hasPermission(String permission) {
if(permission == null) {
System.out.println("NoCheat: Warning, asked for null permission");