Minor safety improvement for godmode check

This commit is contained in:
Evenprime 2011-10-30 17:29:45 +01:00
parent 70d5bc48f2
commit a1286cb966

View File

@ -27,11 +27,20 @@ public class TimedCheck {
if(cc.timed.godmodeCheck && !player.hasPermission(Permissions.TIMED_GODMODE)) {
boolean cancel = false;
BaseData data = plugin.getData(player.getName());
EntityPlayer p = ((CraftPlayer) player).getHandle();
// Haven't been checking before
if(data.timed.ticksLived == 0) {
// setup data for next time
data.timed.ticksLived = p.ticksLived;
// And give up already
return;
}
boolean cancel = false;
// Compare ingame record of players ticks to our last observed value
int difference = p.ticksLived - data.timed.ticksLived;