Add option to reset nofall data if in vehicle. Relates to ticket 535.

This commit is contained in:
asofold 2013-05-29 16:37:31 +02:00
parent dac80f9e32
commit 640409f4d3
5 changed files with 18 additions and 6 deletions

View File

@ -58,13 +58,13 @@ public class MorePacketsVehicle extends Check {
* the from
* @param to
* the to
* @param cc
* @param data
* @return the location
*/
public Location check(final Player player, final Location from, final Location to) {
public Location check(final Player player, final Location from, final Location to, final MovingData data, final MovingConfig cc) {
// Take time once, first:
final long time = System.currentTimeMillis();
final MovingData data = MovingData.getData(player);
Location newTo = null;
@ -91,8 +91,7 @@ public class MorePacketsVehicle extends Check {
// Execute whatever actions are associated with this check and the violation level and find out if we should
// cancel the event.
if (executeActions(player, data.morePacketsVehicleVL, -data.morePacketsVehicleBuffer,
MovingConfig.getConfig(player).morePacketsVehicleActions)){
if (executeActions(player, data.morePacketsVehicleVL, -data.morePacketsVehicleBuffer, cc.morePacketsVehicleActions)){
newTo = data.getMorePacketsVehicleSetBack();
}
}

View File

@ -85,6 +85,8 @@ public class MovingConfig extends ACheckConfig {
public final boolean noFallViolationReset;
/** Reset data on tp. */
public final boolean noFallTpReset;
/** Reset if in vehicle. */
public final boolean noFallVehicleReset;
/** Reset fd to 0 if on ground (dealdamage only). */
public final boolean noFallAntiCriticals;
public final ActionList noFallActions;
@ -160,6 +162,7 @@ public class MovingConfig extends ACheckConfig {
noFallDealDamage = config.getBoolean(ConfPaths.MOVING_NOFALL_DEALDAMAGE);
noFallViolationReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVL);
noFallTpReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONTP);
noFallVehicleReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVEHICLE);
noFallAntiCriticals = config.getBoolean(ConfPaths.MOVING_NOFALL_ANTICRITICALS);
noFallActions = config.getOptimizedActionList(ConfPaths.MOVING_NOFALL_ACTIONS, Permissions.MOVING_NOFALL);

View File

@ -1089,9 +1089,17 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
final MovingData data = MovingData.getData(player);
data.sfNoLowJump = true;
final MovingConfig cc = MovingConfig.getConfig(player);
if (cc.noFallVehicleReset){
// Reset noFall data.
data.noFallSkipAirCheck = true; // Might allow one time cheat.
data.sfLowJump = false;
data.clearNoFallData();
}
if (morePacketsVehicle.isEnabled(player)){
// If the player is handled by the more packets vehicle check, execute it.
newTo = morePacketsVehicle.check(player, from, to);
newTo = morePacketsVehicle.check(player, from, to, data, cc);
}
else{
// Otherwise we need to clear his data.

View File

@ -535,6 +535,7 @@ public abstract class ConfPaths {
public static final String MOVING_NOFALL_DEALDAMAGE = MOVING_NOFALL + "dealdamage";
public static final String MOVING_NOFALL_RESETONVL = MOVING_NOFALL + "resetonviolation";
public static final String MOVING_NOFALL_RESETONTP = MOVING_NOFALL + "resetonteleport";
public static final String MOVING_NOFALL_RESETONVEHICLE = MOVING_NOFALL + "resetonvehicle";
public static final String MOVING_NOFALL_ANTICRITICALS = MOVING_NOFALL + "anticriticals";
public static final String MOVING_NOFALL_ACTIONS = MOVING_NOFALL + "actions";

View File

@ -417,6 +417,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_NOFALL_DEALDAMAGE, true);
set(ConfPaths.MOVING_NOFALL_RESETONVL, false);
set(ConfPaths.MOVING_NOFALL_RESETONTP, false);
set(ConfPaths.MOVING_NOFALL_RESETONVEHICLE, true);
set(ConfPaths.MOVING_NOFALL_ANTICRITICALS, true);
set(ConfPaths.MOVING_NOFALL_ACTIONS, "log:nofall:0:5:if cancel vl>30 log:nofall:0:5:icf cancel");