mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-20 14:31:24 +01:00
Add triggers to combined.invulnerable to keep it more minimal.
This commit is contained in:
parent
7398952c5e
commit
84555c4e51
@ -54,6 +54,8 @@ public class CombinedConfig extends ACheckConfig {
|
|||||||
public final Set<DamageCause> invulnerableIgnore = new HashSet<DamageCause>();
|
public final Set<DamageCause> invulnerableIgnore = new HashSet<DamageCause>();
|
||||||
public final Map<DamageCause, Integer> invulnerableModifiers = new HashMap<DamageCause, Integer>();
|
public final Map<DamageCause, Integer> invulnerableModifiers = new HashMap<DamageCause, Integer>();
|
||||||
public final int invulnerableModifierDefault;
|
public final int invulnerableModifierDefault;
|
||||||
|
public final boolean invulnerableTriggerAlways;
|
||||||
|
public final boolean invulnerableTriggerFallDistance;
|
||||||
|
|
||||||
// Last yaw tracking
|
// Last yaw tracking
|
||||||
public final float yawRate;
|
public final float yawRate;
|
||||||
@ -98,6 +100,8 @@ public class CombinedConfig extends ACheckConfig {
|
|||||||
}
|
}
|
||||||
invulnerableModifierDefault = defaultMod;
|
invulnerableModifierDefault = defaultMod;
|
||||||
if (error) CheckUtils.logInfo("[NoCheatPlus] Damage causes can be: " + CheckUtils.join(Arrays.asList(DamageCause.values()), ", "));
|
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);
|
yawRate = config.getInt(ConfPaths.COMBINED_YAWRATE_RATE);
|
||||||
yawRateImprobable = config.getBoolean(ConfPaths.COMBINED_YAWRATE_IMPROBABLE);
|
yawRateImprobable = config.getBoolean(ConfPaths.COMBINED_YAWRATE_IMPROBABLE);
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@ public class CombinedListener implements Listener {
|
|||||||
final CombinedData data = CombinedData.getData(player);
|
final CombinedData data = CombinedData.getData(player);
|
||||||
final CombinedConfig cc = CombinedConfig.getConfig(player);
|
final CombinedConfig cc = CombinedConfig.getConfig(player);
|
||||||
|
|
||||||
if (cc.invulnerableCheck){
|
if (cc.invulnerableCheck && (cc.invulnerableTriggerAlways || cc.invulnerableTriggerFallDistance && player.getFallDistance() > 0)){
|
||||||
// TODO: maybe allow to set a different number of ticks !
|
// 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 EntityPlayer mcPlayer= ((CraftPlayer) player).getHandle();
|
||||||
final int ticks = cc.invulnerableInitialTicksJoin >= 0 ? cc.invulnerableInitialTicksJoin : mcPlayer.invulnerableTicks;
|
final int ticks = cc.invulnerableInitialTicksJoin >= 0 ? cc.invulnerableInitialTicksJoin : mcPlayer.invulnerableTicks;
|
||||||
data.invulnerableTick = TickTask.getTick() + ticks;
|
data.invulnerableTick = TickTask.getTick() + ticks;
|
||||||
|
@ -309,7 +309,10 @@ public abstract class ConfPaths {
|
|||||||
private static final String COMBINED_INVULNERABLE_INITIALTICKS = COMBINED_INVULNERABLE + "initialticks.";
|
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_INITIALTICKS_JOIN = COMBINED_INVULNERABLE_INITIALTICKS + "join";
|
||||||
public static final String COMBINED_INVULNERABLE_IGNORE = COMBINED_INVULNERABLE + "ignore";
|
public static final String COMBINED_INVULNERABLE_IGNORE = COMBINED_INVULNERABLE + "ignore";
|
||||||
public static final String COMBINED_INVULNERABLE_MODIFIERS = COMBINED_INVULNERABLE + "modifiers";
|
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.";
|
private static final String COMBINED_YAWRATE = COMBINED + "yawrate.";
|
||||||
@ -478,4 +481,5 @@ public abstract class ConfPaths {
|
|||||||
* "8",P"
|
* "8",P"
|
||||||
*/
|
*/
|
||||||
public static final String STRINGS = "strings";
|
public static final String STRINGS = "strings";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -235,6 +235,8 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
|
|
||||||
|
|
||||||
set(ConfPaths.COMBINED_INVULNERABLE_CHECK, true);
|
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_INITIALTICKS_JOIN, -1);
|
||||||
set(ConfPaths.COMBINED_INVULNERABLE_IGNORE, new LinkedList<String>(Arrays.asList(new String[]{"FALL"})));
|
set(ConfPaths.COMBINED_INVULNERABLE_IGNORE, new LinkedList<String>(Arrays.asList(new String[]{"FALL"})));
|
||||||
set(ConfPaths.COMBINED_INVULNERABLE_MODIFIERS + ".all", 0);
|
set(ConfPaths.COMBINED_INVULNERABLE_MODIFIERS + ".all", 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user