mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-10 05:29:12 +01:00
Remove blockinteract.speed debug feedback message.
This commit is contained in:
parent
3a64ab960f
commit
f87873ba04
@ -4,49 +4,44 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
|
||||
public class Speed extends Check {
|
||||
|
||||
public Speed() {
|
||||
super(CheckType.BLOCKINTERACT_SPEED);
|
||||
}
|
||||
|
||||
public boolean check(final Player player, final BlockInteractData data, final BlockInteractConfig cc){
|
||||
|
||||
final long time = System.currentTimeMillis();
|
||||
|
||||
if (time < data.speedTime || time > data.speedTime + cc.speedInterval){
|
||||
data.speedTime = time;
|
||||
data.speedCount = 0;
|
||||
}
|
||||
|
||||
// Increase count.
|
||||
data.speedCount ++;
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
if (data.speedCount > cc.speedLimit){
|
||||
// Lag correction
|
||||
final int correctedCount = (int) ((double) data.speedCount / TickTask.getLag(time - data.speedTime, true));
|
||||
if (correctedCount > cc.speedLimit){
|
||||
data.speedVL ++;
|
||||
if (executeActions(player, data.speedVL, 1, cc.speedActions)){
|
||||
cancel = true;
|
||||
}
|
||||
}
|
||||
// else: keep vl.
|
||||
}
|
||||
else{
|
||||
data.speedVL *= 0.99;
|
||||
}
|
||||
|
||||
if (data.debug && player.hasPermission(Permissions.ADMINISTRATION_DEBUG)){
|
||||
player.sendMessage("Interact speed: " + data.speedCount);
|
||||
}
|
||||
|
||||
return cancel;
|
||||
}
|
||||
public Speed() {
|
||||
super(CheckType.BLOCKINTERACT_SPEED);
|
||||
}
|
||||
|
||||
public boolean check(final Player player, final BlockInteractData data, final BlockInteractConfig cc){
|
||||
|
||||
final long time = System.currentTimeMillis();
|
||||
|
||||
if (time < data.speedTime || time > data.speedTime + cc.speedInterval){
|
||||
data.speedTime = time;
|
||||
data.speedCount = 0;
|
||||
}
|
||||
|
||||
// Increase count.
|
||||
data.speedCount ++;
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
if (data.speedCount > cc.speedLimit){
|
||||
// Lag correction
|
||||
final int correctedCount = (int) ((double) data.speedCount / TickTask.getLag(time - data.speedTime, true));
|
||||
if (correctedCount > cc.speedLimit){
|
||||
data.speedVL ++;
|
||||
if (executeActions(player, data.speedVL, 1, cc.speedActions)){
|
||||
cancel = true;
|
||||
}
|
||||
}
|
||||
// else: keep vl.
|
||||
}
|
||||
else{
|
||||
data.speedVL *= 0.99;
|
||||
}
|
||||
|
||||
return cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user