Fix crop trampling being disabled by anticriticals.

This commit is contained in:
asofold 2013-04-21 21:23:51 +02:00
parent e26aec2cbd
commit 19ddaefb4c
2 changed files with 38 additions and 33 deletions

View File

@ -64,9 +64,10 @@ public class Critical extends Check {
// Check if the hit was a critical hit (positive fall distance, entity in the air, not on ladder, not in liquid
// and without blindness effect).
if (mcFallDistance > 0f && !BlockProperties.isOnGroundOrResetCond(player, loc, mCc.yOnGround) && !player.hasPotionEffect(PotionEffectType.BLINDNESS)){
// It was a critical hit, now check if the player has jumped or has sent a packet to mislead the server.
if (player.getFallDistance() < cc.criticalFallDistance) { // removed velocity
// TODO: Skip the on-ground check somehow?
// TODO: Implement low jump penalty.
if (mcFallDistance > 0f && player.getFallDistance() < cc.criticalFallDistance &&!BlockProperties.isOnGroundOrResetCond(player, loc, mCc.yOnGround) && !player.hasPotionEffect(PotionEffectType.BLINDNESS)){
final MovingConfig ccM = MovingConfig.getConfig(player);
final MovingData dataM = MovingData.getData(player);
if (MovingListener.shouldCheckSurvivalFly(player, dataM, ccM)){
@ -84,13 +85,10 @@ public class Critical extends Check {
data.criticalVL += delta;
}
// Execute whatever actions are associated with this check and the violation level and find out if we
// should cancel the event.
cancel = executeActions(player, data.criticalVL, delta, cc.criticalActions);
}
}
}
return cancel;

View File

@ -164,8 +164,12 @@ public class NoFall extends Check {
if (!toReset && !toOnGround && yDiff < 0){
data.noFallFallDistance -= yDiff;
}
else if (cc.noFallDealDamage && cc.noFallAntiCriticals && (toReset || toOnGround || (fromReset || fromOnGround || data.noFallAssumeGround) && yDiff >= 0)){
// TODO: Only use this if dealdamage is true ?
else if (cc.noFallAntiCriticals && (toReset || toOnGround || (fromReset || fromOnGround || data.noFallAssumeGround) && yDiff >= 0)){
final double max = Math.max(data.noFallFallDistance, mcFallDistance);
if (max > 0.0 && max < 0.75){ // (Ensure this does not conflict with deal-damage set to false.)
if (cc.debug){
System.out.println(player.getName() + " NoFall: Reset fall distance (anticriticals): mc=" + StringUtil.fdec3.format(mcFallDistance) +" / nf=" + StringUtil.fdec3.format(data.noFallFallDistance) );
}
if (data.noFallFallDistance > 0){
data.noFallFallDistance = 0;
}
@ -173,8 +177,11 @@ public class NoFall extends Check {
player.setFallDistance(0);
}
}
}
if (cc.debug) System.out.println(player.getName() + " NoFall: mc=" + StringUtil.fdec3.format(player.getFallDistance()) +" / nf=" + StringUtil.fdec3.format(data.noFallFallDistance) + (oldNFDist < data.noFallFallDistance ? " (+" + StringUtil.fdec3.format(data.noFallFallDistance - oldNFDist) + ")" : ""));
if (cc.debug){
System.out.println(player.getName() + " NoFall: mc=" + StringUtil.fdec3.format(mcFallDistance) +" / nf=" + StringUtil.fdec3.format(data.noFallFallDistance) + (oldNFDist < data.noFallFallDistance ? " (+" + StringUtil.fdec3.format(data.noFallFallDistance - oldNFDist) + ")" : ""));
}
}