Add loginticks to sf/hover to allow extra counting down before really

checking.
This commit is contained in:
asofold 2013-03-03 17:38:19 +01:00
parent feaa09ad03
commit 7ac499af06
5 changed files with 62 additions and 48 deletions

View File

@ -112,6 +112,7 @@ public class MovingConfig extends ACheckConfig {
public final boolean sfHoverCheck; public final boolean sfHoverCheck;
public final int sfHoverTicks; public final int sfHoverTicks;
public final int sfHoverLoginTicks;
public final boolean sfHoverFallDamage; public final boolean sfHoverFallDamage;
public final double sfHoverViolation; public final double sfHoverViolation;
@ -125,66 +126,67 @@ public class MovingConfig extends ACheckConfig {
/** /**
* Instantiates a new moving configuration. * Instantiates a new moving configuration.
* *
* @param data * @param config
* the data * the data
*/ */
public MovingConfig(final ConfigFile data) { public MovingConfig(final ConfigFile config) {
super(data, ConfPaths.MOVING); super(config, ConfPaths.MOVING);
ignoreCreative = data.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE); ignoreCreative = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE);
ignoreAllowFlight = data.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT); ignoreAllowFlight = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT);
creativeFlyCheck = data.getBoolean(ConfPaths.MOVING_CREATIVEFLY_CHECK); creativeFlyCheck = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_CHECK);
creativeFlyHorizontalSpeed = data.getInt(ConfPaths.MOVING_CREATIVEFLY_HORIZONTALSPEED); creativeFlyHorizontalSpeed = config.getInt(ConfPaths.MOVING_CREATIVEFLY_HORIZONTALSPEED);
creativeFlyMaxHeight = data.getInt(ConfPaths.MOVING_CREATIVEFLY_MAXHEIGHT); creativeFlyMaxHeight = config.getInt(ConfPaths.MOVING_CREATIVEFLY_MAXHEIGHT);
creativeFlyVerticalSpeed = data.getInt(ConfPaths.MOVING_CREATIVEFLY_VERTICALSPEED); creativeFlyVerticalSpeed = config.getInt(ConfPaths.MOVING_CREATIVEFLY_VERTICALSPEED);
creativeFlyActions = data.getOptimizedActionList(ConfPaths.MOVING_CREATIVEFLY_ACTIONS, Permissions.MOVING_CREATIVEFLY); creativeFlyActions = config.getOptimizedActionList(ConfPaths.MOVING_CREATIVEFLY_ACTIONS, Permissions.MOVING_CREATIVEFLY);
morePacketsCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK); morePacketsCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK);
morePacketsActions = data.getOptimizedActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS); morePacketsActions = config.getOptimizedActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS);
morePacketsVehicleCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETSVEHICLE_CHECK); morePacketsVehicleCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETSVEHICLE_CHECK);
morePacketsVehicleActions = data.getOptimizedActionList(ConfPaths.MOVING_MOREPACKETSVEHICLE_ACTIONS, morePacketsVehicleActions = config.getOptimizedActionList(ConfPaths.MOVING_MOREPACKETSVEHICLE_ACTIONS,
Permissions.MOVING_MOREPACKETS); Permissions.MOVING_MOREPACKETS);
noFallCheck = data.getBoolean(ConfPaths.MOVING_NOFALL_CHECK); noFallCheck = config.getBoolean(ConfPaths.MOVING_NOFALL_CHECK);
noFallDealDamage = data.getBoolean(ConfPaths.MOVING_NOFALL_DEALDAMAGE); noFallDealDamage = config.getBoolean(ConfPaths.MOVING_NOFALL_DEALDAMAGE);
noFallViolationReset = data.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVL); noFallViolationReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVL);
noFallTpReset = data.getBoolean(ConfPaths.MOVING_NOFALL_RESETONTP); noFallTpReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONTP);
noFallAntiCriticals = data.getBoolean(ConfPaths.MOVING_NOFALL_ANTICRITICALS); noFallAntiCriticals = config.getBoolean(ConfPaths.MOVING_NOFALL_ANTICRITICALS);
noFallActions = data.getOptimizedActionList(ConfPaths.MOVING_NOFALL_ACTIONS, Permissions.MOVING_NOFALL); noFallActions = config.getOptimizedActionList(ConfPaths.MOVING_NOFALL_ACTIONS, Permissions.MOVING_NOFALL);
passableCheck = data.getBoolean(ConfPaths.MOVING_PASSABLE_CHECK); passableCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_CHECK);
passableRayTracingCheck = data.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_CHECK); passableRayTracingCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_CHECK);
passableRayTracingBlockChangeOnly = data.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_BLOCKCHANGEONLY); passableRayTracingBlockChangeOnly = config.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_BLOCKCHANGEONLY);
passableRayTracingVclipOnly = data.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_VCLIPONLY); passableRayTracingVclipOnly = config.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_VCLIPONLY);
passableActions = data.getOptimizedActionList(ConfPaths.MOVING_PASSABLE_ACTIONS, Permissions.MOVING_PASSABLE); passableActions = config.getOptimizedActionList(ConfPaths.MOVING_PASSABLE_ACTIONS, Permissions.MOVING_PASSABLE);
survivalFlyCheck = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_CHECK); survivalFlyCheck = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_CHECK);
// Default values are specified here because this settings aren't showed by default into the configuration file. // 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); survivalFlyBlockingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_BLOCKINGSPEED, 100);
survivalFlySneakingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SNEAKINGSPEED, 100); survivalFlySneakingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SNEAKINGSPEED, 100);
survivalFlySpeedingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SPEEDINGSPEED, 200); survivalFlySpeedingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SPEEDINGSPEED, 200);
survivalFlySprintingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SPRINTINGSPEED, 100); survivalFlySprintingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SPRINTINGSPEED, 100);
survivalFlySwimmingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100); survivalFlySwimmingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100);
survivalFlyWalkingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100); survivalFlyWalkingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100);
survivalFlyCobwebHack = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true); survivalFlyCobwebHack = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true);
survivalFlyAccountingH = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_HACC, false); survivalFlyAccountingH = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_HACC, false);
survivalFlyAccountingV = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_VACC); survivalFlyAccountingV = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_VACC);
sfFallDamage = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_FALLDAMAGE); sfFallDamage = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_FALLDAMAGE);
survivalFlyVLFreeze = data.getLong(ConfPaths.MOVING_SURVIVALFLY_VLFREEZE, 2000L); survivalFlyVLFreeze = config.getLong(ConfPaths.MOVING_SURVIVALFLY_VLFREEZE, 2000L);
survivalFlyActions = data.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY); survivalFlyActions = config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY);
sfHoverCheck = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK); sfHoverCheck = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK);
sfHoverTicks = data.getInt(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS); sfHoverTicks = config.getInt(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS);
sfHoverFallDamage = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE); sfHoverLoginTicks = Math.max(0, config.getInt(ConfPaths.MOVING_SURVIVALFLY_HOVER_LOGINTICKS));
sfHoverViolation = data.getDouble(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION); sfHoverFallDamage = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE);
sfHoverViolation = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION);
velocityGraceTicks = data.getInt(ConfPaths.MOVING_VELOCITY_GRACETICKS); velocityGraceTicks = config.getInt(ConfPaths.MOVING_VELOCITY_GRACETICKS);
yOnGround = data.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.0626); // sqrt(1/256), see: NetServerHandler. yOnGround = config.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.0626); // sqrt(1/256), see: NetServerHandler.
noFallyOnGround = data.getDouble(ConfPaths.MOVING_NOFALL_YONGROUND, 0.001, 2.0, yOnGround); noFallyOnGround = config.getDouble(ConfPaths.MOVING_NOFALL_YONGROUND, 0.001, 2.0, yOnGround);
// ystep is set to 0.45 by default, for stairs / steps. // ystep is set to 0.45 by default, for stairs / steps.
yStep = data.getDouble(ConfPaths.MOVING_SURVIVALFLY_YSTEP, 0.001, 0.45, 0.1); yStep = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_YSTEP, 0.001, 0.45, 0.1);
} }

View File

@ -150,8 +150,10 @@ public class MovingData extends ACheckData {
* Last valid y distance covered by a move. Integer.MAX_VALUE indicates "not set". * Last valid y distance covered by a move. Integer.MAX_VALUE indicates "not set".
*/ */
public double sfLastYDist = Double.MAX_VALUE; public double sfLastYDist = Double.MAX_VALUE;
/** A value <0 means not hovering at all. */ /** Counting while the player is not on ground and not moving. A value <0 means not hovering at all. */
public int sfHoverTicks = -1; public int sfHoverTicks = -1;
/** First count these down before incrementing sfHoverTicks. Set on join, if configured so. */
public int sfHoverLoginTicks = 0;
public int sfFlyOnIce = 0; public int sfFlyOnIce = 0;
public long sfCobwebTime = 0; public long sfCobwebTime = 0;
public double sfCobwebVL = 0; public double sfCobwebVL = 0;
@ -175,7 +177,7 @@ public class MovingData extends ACheckData {
clearNoFallData(); clearNoFallData();
sfHorizontalBuffer = 0; sfHorizontalBuffer = 0;
toWasReset = fromWasReset = false; // TODO: true maybe toWasReset = fromWasReset = false; // TODO: true maybe
sfHoverTicks = -1; sfHoverTicks = sfHoverLoginTicks = -1;
sfDirty = false; sfDirty = false;
mediumLiftOff = defaultMediumLiftOff; mediumLiftOff = defaultMediumLiftOff;
} }

View File

@ -1132,9 +1132,11 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
// Start as if hovering already. // Start as if hovering already.
// Could check shouldCheckSurvivalFly(player, data, cc), but this should be more sharp (gets checked on violation). // Could check shouldCheckSurvivalFly(player, data, cc), but this should be more sharp (gets checked on violation).
data.sfHoverTicks = 0; data.sfHoverTicks = 0;
data.sfHoverLoginTicks = cc.sfHoverLoginTicks;
hoverTicks.add(player.getName()); hoverTicks.add(player.getName());
} }
else{ else{
data.sfHoverLoginTicks = 0;
data.sfHoverTicks = -1; data.sfHoverTicks = -1;
} }
} }
@ -1222,9 +1224,15 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
// (Removed below.) // (Removed below.)
} }
if (data.sfHoverTicks < 0){ if (data.sfHoverTicks < 0){
data.sfHoverLoginTicks = 0;
rem.add(playerName); rem.add(playerName);
continue; continue;
} }
else if (data.sfHoverLoginTicks > 0){
// Additional "grace period".
data.sfHoverLoginTicks --;
continue;
}
final MovingConfig cc = MovingConfig.getConfig(player); final MovingConfig cc = MovingConfig.getConfig(player);
// Check if enabled at all. // Check if enabled at all.
if (!cc.sfHoverCheck){ if (!cc.sfHoverCheck){

View File

@ -531,6 +531,7 @@ public abstract class ConfPaths {
private static final String MOVING_SURVIVALFLY_HOVER = MOVING_SURVIVALFLY + "hover."; private static final String MOVING_SURVIVALFLY_HOVER = MOVING_SURVIVALFLY + "hover.";
public static final String MOVING_SURVIVALFLY_HOVER_CHECK = MOVING_SURVIVALFLY_HOVER + "active"; public static final String MOVING_SURVIVALFLY_HOVER_CHECK = MOVING_SURVIVALFLY_HOVER + "active";
public static final String MOVING_SURVIVALFLY_HOVER_TICKS = MOVING_SURVIVALFLY_HOVER + "ticks"; public static final String MOVING_SURVIVALFLY_HOVER_TICKS = MOVING_SURVIVALFLY_HOVER + "ticks";
public static final String MOVING_SURVIVALFLY_HOVER_LOGINTICKS = MOVING_SURVIVALFLY_HOVER + "loginticks";
public static final String MOVING_SURVIVALFLY_HOVER_FALLDAMAGE = MOVING_SURVIVALFLY_HOVER + "falldamage"; public static final String MOVING_SURVIVALFLY_HOVER_FALLDAMAGE = MOVING_SURVIVALFLY_HOVER + "falldamage";
public static final String MOVING_SURVIVALFLY_HOVER_SFVIOLATION = MOVING_SURVIVALFLY_HOVER + "sfviolation"; public static final String MOVING_SURVIVALFLY_HOVER_SFVIOLATION = MOVING_SURVIVALFLY_HOVER + "sfviolation";

View File

@ -423,6 +423,7 @@ public class DefaultConfig extends ConfigFile {
// sf / hover check. // sf / hover check.
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK, true); set(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK, true);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS, 80); set(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS, 80);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_LOGINTICKS, 0);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE, true); set(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE, true);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION, 500); set(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION, 500);