mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-03 00:47:25 +02:00
Removed debug output and some unnecessary code
This commit is contained in:
parent
fb5225fac5
commit
5a02e78888
@ -3,7 +3,7 @@ name: NoCheat
|
|||||||
author: Evenprime
|
author: Evenprime
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||||
version: 2.15a
|
version: 2.16
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
nocheat:
|
nocheat:
|
||||||
|
@ -23,24 +23,20 @@ public class RunflyCheck extends MovingCheck {
|
|||||||
@Override
|
@Override
|
||||||
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) {
|
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) {
|
||||||
|
|
||||||
final boolean runflyCheck = cc.runflyCheck && !player.hasPermission(Permissions.MOVING_RUNFLY);
|
|
||||||
final boolean flyAllowed = cc.allowFlying || player.hasPermission(Permissions.MOVING_FLYING) || (player.isCreative() && cc.identifyCreativeMode);
|
final boolean flyAllowed = cc.allowFlying || player.hasPermission(Permissions.MOVING_FLYING) || (player.isCreative() && cc.identifyCreativeMode);
|
||||||
|
|
||||||
/********************* EXECUTE THE FLY/JUMP/RUNNING CHECK ********************/
|
/********************* EXECUTE THE FLY/JUMP/RUNNING CHECK ********************/
|
||||||
// If the player is not allowed to fly and not allowed to run
|
// If the player is not allowed to fly and not allowed to run
|
||||||
if(runflyCheck) {
|
|
||||||
if(flyAllowed) {
|
|
||||||
return flyingCheck.check(player, data, cc);
|
|
||||||
} else {
|
|
||||||
return runningCheck.check(player, data, cc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
if(flyAllowed) {
|
||||||
|
return flyingCheck.check(player, data, cc);
|
||||||
|
} else {
|
||||||
|
return runningCheck.check(player, data, cc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(CCMoving moving) {
|
public boolean isEnabled(CCMoving moving) {
|
||||||
return runningCheck.isEnabled(moving) || flyingCheck.isEnabled(moving);
|
return moving.runflyCheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class RunningCheck extends MovingCheck {
|
|||||||
|
|
||||||
public RunningCheck(NoCheat plugin) {
|
public RunningCheck(NoCheat plugin) {
|
||||||
|
|
||||||
super(plugin, "moving.running", Permissions.MOVING_RUNFLY);
|
super(plugin, "moving.running", null);
|
||||||
|
|
||||||
this.noFallCheck = new NoFallCheck(plugin);
|
this.noFallCheck = new NoFallCheck(plugin);
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,6 @@ public class GodmodeCheck extends TimedCheck {
|
|||||||
boolean cancel = false;
|
boolean cancel = false;
|
||||||
|
|
||||||
// How far behind is the player with his ticks
|
// How far behind is the player with his ticks
|
||||||
// expected time - real lived time
|
|
||||||
System.out.println("lived "+ticksLived + " data.ticksLived " + data.ticksLived);
|
|
||||||
int behind = Math.min(10, (data.ticksLived + cc.tickTime) - ticksLived);
|
int behind = Math.min(10, (data.ticksLived + cc.tickTime) - ticksLived);
|
||||||
// difference should be >= tickTime for perfect synchronization
|
// difference should be >= tickTime for perfect synchronization
|
||||||
if(behind <= 1) {
|
if(behind <= 1) {
|
||||||
@ -89,7 +87,6 @@ public class GodmodeCheck extends TimedCheck {
|
|||||||
data.godmodeVL = 0;
|
data.godmodeVL = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(data.ticksBehind);
|
|
||||||
// setup data for next time
|
// setup data for next time
|
||||||
data.ticksLived = player.getTicksLived();
|
data.ticksLived = player.getTicksLived();
|
||||||
|
|
||||||
|
@ -30,6 +30,10 @@ public class NoCheatPlayerImpl implements NoCheatPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
|
if(permission == null) {
|
||||||
|
System.out.println("NoCheat: Warning, asked for null permission");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return player.hasPermission(permission);
|
return player.hasPermission(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,11 +74,11 @@ public class NoCheatPlayerImpl implements NoCheatPlayer {
|
|||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSprinting() {
|
public boolean isSprinting() {
|
||||||
return player.isSprinting() && player.getFoodLevel() > 5;
|
return player.isSprinting() && player.getFoodLevel() > 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastUsedTime(long currentTimeInMilliseconds) {
|
public void setLastUsedTime(long currentTimeInMilliseconds) {
|
||||||
this.lastUsedTime = System.currentTimeMillis();
|
this.lastUsedTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user