mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-25 01:47:41 +01:00
Add guard for not having checked at all.
This commit is contained in:
parent
90a1255229
commit
b6034162ee
@ -166,7 +166,10 @@ public class Direction extends Check {
|
||||
public boolean loopFinish(final Player player, final Location loc, final Entity damaged, final DirectionContext context, final boolean forceViolation, final FightData data, final FightConfig cc) {
|
||||
boolean cancel = false;
|
||||
final double off = forceViolation && context.minViolation != Double.MAX_VALUE ? context.minViolation : context.minResult;
|
||||
if (off > 0.1) {
|
||||
if (off == Double.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
else if (off > 0.1) {
|
||||
// Add the overall violation level of the check.
|
||||
data.directionVL += context.minViolation;
|
||||
|
||||
@ -178,7 +181,8 @@ public class Direction extends Check {
|
||||
// Deal an attack penalty time.
|
||||
data.attackPenalty.applyPenalty(cc.directionPenalty);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Reward the player by lowering their violation level.
|
||||
data.directionVL *= 0.8D;
|
||||
}
|
||||
|
@ -251,6 +251,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
reachPassed = true;
|
||||
}
|
||||
}
|
||||
// TODO: For efficiency one could omit checking at all if reach is failed all the time.
|
||||
if (directionEnabled && (reachPassed || !directionPassed)) {
|
||||
if (direction.loopCheck(player, damagedLoc, damagedPlayer, entry, directionContext, data, cc)) {
|
||||
thisPassed = false;
|
||||
|
@ -215,6 +215,9 @@ public class Reach extends Check {
|
||||
*/
|
||||
public boolean loopFinish(final Player player, final Location pLoc, final Entity damaged, final ReachContext context, final boolean forceViolation, final FightData data, final FightConfig cc) {
|
||||
final double lenpRel = forceViolation && context.minViolation != Double.MAX_VALUE ? context.minViolation : context.minResult;
|
||||
if (lenpRel == Double.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
double violation = lenpRel - context.distanceLimit;
|
||||
boolean cancel = false;
|
||||
if (violation > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user