Account for TickTask resetting.

This commit is contained in:
asofold 2013-01-23 03:06:52 +01:00
parent 60114eb6eb
commit cce67ac67c
6 changed files with 31 additions and 7 deletions

View File

@ -244,7 +244,8 @@ public class BlockBreakListener extends CheckListener {
final int tick = TickTask.getTick(); final int tick = TickTask.getTick();
// Skip if already set to the same block without breaking within one tick difference. // Skip if already set to the same block without breaking within one tick difference.
if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()){ if (tick < data.clickedTick);
else if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()){
if (tick - data.clickedTick <= 1 ) return; if (tick - data.clickedTick <= 1 ) return;
} }

View File

@ -76,8 +76,10 @@ public class FastBreak extends Check {
// // Ignore those for now. // // Ignore those for now.
// } // }
// else // else
if (elapsedTime < 0){
if (elapsedTime + cc.fastBreakDelay < breakingTime){ // Ignore it. TODO: ?
}
else if (elapsedTime + cc.fastBreakDelay < breakingTime){
// lag or cheat or Minecraft. // lag or cheat or Minecraft.
// Count in server side lag, if desired. // Count in server side lag, if desired.

View File

@ -29,7 +29,12 @@ public class Frequency extends Check {
// Short term arrivals. // Short term arrivals.
final int tick = TickTask.getTick(); final int tick = TickTask.getTick();
if (tick - data.frequencyShortTermTick < cc.frequencyShortTermTicks){ if (tick < data.frequencyShortTermTick){
// Tick task got reset.
data.frequencyShortTermTick = tick;
data.frequencyShortTermCount = 1;
}
else if (tick - data.frequencyShortTermTick < cc.frequencyShortTermTicks){
// Account for server side lag. // Account for server side lag.
final float stLag = cc.lag ? TickTask.getLag(50L * (tick - data.frequencyShortTermTick), true) : 1f; final float stLag = cc.lag ? TickTask.getLag(50L * (tick - data.frequencyShortTermTick), true) : 1f;
if (stLag < 1.5){ if (stLag < 1.5){

View File

@ -48,7 +48,12 @@ public class FastPlace extends Check {
// Short term arrivals. // Short term arrivals.
final int tick = TickTask.getTick(); final int tick = TickTask.getTick();
if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks){ if (tick < data.fastPlaceShortTermTick ){
// TickTask got reset.
data.fastPlaceShortTermTick = tick;
data.fastPlaceShortTermCount = 1;
}
else if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks){
// Account for server side lag. // Account for server side lag.
if (!cc.lag || TickTask.getLag(50L * (tick - data.fastPlaceShortTermTick), true) < 1.2){ if (!cc.lag || TickTask.getLag(50L * (tick - data.fastPlaceShortTermTick), true) < 1.2){
// Within range, add. // Within range, add.

View File

@ -41,7 +41,13 @@ public class Commands extends Check {
final float weight = 1f; final float weight = 1f;
data.commandsWeights.add(now, weight); data.commandsWeights.add(now, weight);
if (tick - data.commandsShortTermTick < cc.commandsShortTermTicks){ if (tick < data.commandsShortTermTick){
// TickTask got reset.
data.commandsShortTermTick = tick;
data.commandsShortTermWeight = 1.0;
}
else if (tick - data.commandsShortTermTick < cc.commandsShortTermTicks){
// TODO: account for lag.
// Add up. // Add up.
data.commandsShortTermWeight += weight; data.commandsShortTermWeight += weight;
} }

View File

@ -56,7 +56,12 @@ public class Speed extends Check {
// Short term. // Short term.
final int tick = TickTask.getTick(); final int tick = TickTask.getTick();
if (tick - data.speedShortTermTick < cc.speedShortTermTicks){ if (tick < data.speedShortTermTick){
// Tick task got reset.
data.speedShortTermTick = tick;
data.speedShortTermCount = 1;
}
else if (tick - data.speedShortTermTick < cc.speedShortTermTicks){
// Account for server side lag. // Account for server side lag.
if (!cc.lag || TickTask.getLag(50L * (tick - data.speedShortTermTick), true) < 1.5f){ if (!cc.lag || TickTask.getLag(50L * (tick - data.speedShortTermTick), true) < 1.5f){
// Within range, add. // Within range, add.