Add triggers to combined.invulnerable to keep it more minimal.

This commit is contained in:
asofold 2012-10-03 17:47:29 +02:00
parent 7398952c5e
commit 84555c4e51
4 changed files with 18 additions and 8 deletions

View File

@ -54,6 +54,8 @@ public class CombinedConfig extends ACheckConfig {
public final Set<DamageCause> invulnerableIgnore = new HashSet<DamageCause>();
public final Map<DamageCause, Integer> invulnerableModifiers = new HashMap<DamageCause, Integer>();
public final int invulnerableModifierDefault;
public final boolean invulnerableTriggerAlways;
public final boolean invulnerableTriggerFallDistance;
// Last yaw tracking
public final float yawRate;
@ -98,6 +100,8 @@ public class CombinedConfig extends ACheckConfig {
}
invulnerableModifierDefault = defaultMod;
if (error) CheckUtils.logInfo("[NoCheatPlus] Damage causes can be: " + CheckUtils.join(Arrays.asList(DamageCause.values()), ", "));
invulnerableTriggerAlways = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_ALWAYS);
invulnerableTriggerFallDistance = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_FALLDISTANCE);
yawRate = config.getInt(ConfPaths.COMBINED_YAWRATE_RATE);
yawRateImprobable = config.getBoolean(ConfPaths.COMBINED_YAWRATE_IMPROBABLE);
}

View File

@ -72,8 +72,8 @@ public class CombinedListener implements Listener {
final CombinedData data = CombinedData.getData(player);
final CombinedConfig cc = CombinedConfig.getConfig(player);
if (cc.invulnerableCheck){
// TODO: maybe allow to set a different number of ticks !
if (cc.invulnerableCheck && (cc.invulnerableTriggerAlways || cc.invulnerableTriggerFallDistance && player.getFallDistance() > 0)){
// TODO: maybe make a heuristic for small fall distances with ground under feet (prevents future abuse with jumping) ?
final EntityPlayer mcPlayer= ((CraftPlayer) player).getHandle();
final int ticks = cc.invulnerableInitialTicksJoin >= 0 ? cc.invulnerableInitialTicksJoin : mcPlayer.invulnerableTicks;
data.invulnerableTick = TickTask.getTick() + ticks;

View File

@ -304,12 +304,15 @@ public abstract class ConfPaths {
public static final String COMBINED_IMPROBABLE_ACTIONS = COMBINED_IMPROBABLE + "actions";
private static final String COMBINED_INVULNERABLE = COMBINED + "invulnerable.";
public static final String COMBINED_INVULNERABLE_CHECK = COMBINED_INVULNERABLE + "active";
private static final String COMBINED_INVULNERABLE_INITIALTICKS = COMBINED_INVULNERABLE + "initialticks.";
public static final String COMBINED_INVULNERABLE_INITIALTICKS_JOIN = COMBINED_INVULNERABLE_INITIALTICKS + "join";
public static final String COMBINED_INVULNERABLE_IGNORE = COMBINED_INVULNERABLE + "ignore";
public static final String COMBINED_INVULNERABLE_MODIFIERS = COMBINED_INVULNERABLE + "modifiers";
private static final String COMBINED_INVULNERABLE = COMBINED + "invulnerable.";
public static final String COMBINED_INVULNERABLE_CHECK = COMBINED_INVULNERABLE + "active";
private static final String COMBINED_INVULNERABLE_INITIALTICKS = COMBINED_INVULNERABLE + "initialticks.";
public static final String COMBINED_INVULNERABLE_INITIALTICKS_JOIN = COMBINED_INVULNERABLE_INITIALTICKS + "join";
public static final String COMBINED_INVULNERABLE_IGNORE = COMBINED_INVULNERABLE + "ignore";
public static final String COMBINED_INVULNERABLE_MODIFIERS = COMBINED_INVULNERABLE + "modifiers"; // no dot !
private static final String COMBINED_INVULNERABLE_TRIGGERS = COMBINED_INVULNERABLE + "triggers.";
public static final String COMBINED_INVULNERABLE_TRIGGERS_ALWAYS = COMBINED_INVULNERABLE_TRIGGERS + "always";
public static final String COMBINED_INVULNERABLE_TRIGGERS_FALLDISTANCE = COMBINED_INVULNERABLE_TRIGGERS + "falldistance";
private static final String COMBINED_YAWRATE = COMBINED + "yawrate.";
@ -478,4 +481,5 @@ public abstract class ConfPaths {
* "8",P"
*/
public static final String STRINGS = "strings";
}

View File

@ -235,6 +235,8 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.COMBINED_INVULNERABLE_CHECK, true);
set(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_ALWAYS, false);
set(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_FALLDISTANCE, true);
set(ConfPaths.COMBINED_INVULNERABLE_INITIALTICKS_JOIN, -1);
set(ConfPaths.COMBINED_INVULNERABLE_IGNORE, new LinkedList<String>(Arrays.asList(new String[]{"FALL"})));
set(ConfPaths.COMBINED_INVULNERABLE_MODIFIERS + ".all", 0);