mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 08:40:01 +01:00
Add speedingspeed and permission (speeding) to survivalfly.
This commit is contained in:
parent
7005b141cf
commit
acabe72db1
@ -79,6 +79,7 @@ public class MovingConfig implements CheckConfig {
|
||||
public final boolean survivalFlyCheck;
|
||||
public final int survivalFlyBlockingSpeed;
|
||||
public final int survivalFlySneakingSpeed;
|
||||
public final int survivalFlySpeedingSpeed;
|
||||
public final int survivalFlySprintingSpeed;
|
||||
public final int survivalFlySwimmingSpeed;
|
||||
public final int survivalFlyWalkingSpeed;
|
||||
@ -89,6 +90,7 @@ public class MovingConfig implements CheckConfig {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new moving configuration.
|
||||
*
|
||||
@ -116,6 +118,7 @@ public class MovingConfig implements CheckConfig {
|
||||
// Default values are specified here because this settings aren't showed by default into the configuration file.
|
||||
survivalFlyBlockingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_BLOCKINGSPEED, 100);
|
||||
survivalFlySneakingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SNEAKINGSPEED, 100);
|
||||
survivalFlySpeedingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SPEEDINGSPEED, 100);
|
||||
survivalFlySprintingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SPRINTINGSPEED, 100);
|
||||
survivalFlySwimmingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100);
|
||||
survivalFlyWalkingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100);
|
||||
|
@ -100,10 +100,19 @@ public class SurvivalFly extends Check {
|
||||
hAllowedDistance = 0.13D * cc.survivalFlySneakingSpeed / 100D;
|
||||
else if (player.isBlocking() && !player.hasPermission(Permissions.MOVING_SURVIVALFLY_BLOCKING))
|
||||
hAllowedDistance = 0.16D * cc.survivalFlyBlockingSpeed / 100D;
|
||||
else if (!sprinting)
|
||||
hAllowedDistance = 0.22D * cc.survivalFlyWalkingSpeed / 100D;
|
||||
else
|
||||
hAllowedDistance = 0.35D * cc.survivalFlySprintingSpeed / 100D;
|
||||
else{
|
||||
if (!sprinting)
|
||||
hAllowedDistance = 0.22D * cc.survivalFlyWalkingSpeed / 100D;
|
||||
else
|
||||
hAllowedDistance = 0.35D * cc.survivalFlySprintingSpeed / 100D;
|
||||
|
||||
// Speeding bypass permission (can be combined with other bypasses).
|
||||
// TODO: How exactly to bring it on finally.
|
||||
if (player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPEEDING))
|
||||
hAllowedDistance = hAllowedDistance * cc.survivalFlySpeedingSpeed/ 100D;
|
||||
}
|
||||
|
||||
// TODO: Optimize: maybe only do the permission checks and modifiers if the distance is too big.
|
||||
|
||||
// If the player is on ice, give him an higher maximum speed.
|
||||
if (data.survivalFlyOnIce > 0)
|
||||
@ -199,10 +208,6 @@ public class SurvivalFly extends Check {
|
||||
if (from.isOnGround() || to.isOnGround())
|
||||
data.jumpAmplifier = 0D;
|
||||
|
||||
// Speeding bypass permission:
|
||||
if (hDistanceAboveLimit > 0 && player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPEEDING))
|
||||
hDistanceAboveLimit = 0D;
|
||||
|
||||
final double result = (Math.max(hDistanceAboveLimit, 0D) + Math.max(vDistanceAboveLimit, 0D)) * 100D;
|
||||
|
||||
data.survivalFlyJumpPhase++;
|
||||
|
@ -338,6 +338,7 @@ public abstract class ConfPaths {
|
||||
public static final String MOVING_SURVIVALFLY_CHECK = MOVING_SURVIVALFLY + "active";
|
||||
public static final String MOVING_SURVIVALFLY_BLOCKINGSPEED = MOVING_SURVIVALFLY + "blockingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_SNEAKINGSPEED = MOVING_SURVIVALFLY + "sneakingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_SPEEDINGSPEED = MOVING_SURVIVALFLY + "speedingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_SPRINTINGSPEED = MOVING_SURVIVALFLY + "sprintingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_SWIMMINGSPEED = MOVING_SURVIVALFLY + "swimmingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed";
|
||||
|
Loading…
Reference in New Issue
Block a user