mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-19 14:59:30 +00:00
Add configurable cap on the damage players can take in a single hit
This commit is contained in:
@@ -64,6 +64,19 @@
|
||||
} else if (damageSource.is(DamageTypeTags.IS_DROWNING)) {
|
||||
return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE);
|
||||
} else if (damageSource.is(DamageTypeTags.IS_FALL)) {
|
||||
@@ -755,6 +_,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - add max damage taken
|
||||
+ final double maxDamage = level.sakuraConfig().players.combat.maxDamage.or(-1.0);
|
||||
+ if (amount > 0.0 && maxDamage >= 0.0) {
|
||||
+ amount = Math.min(amount, (float) maxDamage);
|
||||
+ }
|
||||
+ // Sakura end - add max damage taken
|
||||
// return amount != 0.0F && super.hurtServer(level, damageSource, amount);
|
||||
// CraftBukkit start - Don't filter out 0 damage
|
||||
boolean damaged = super.hurtServer(level, damageSource, amount);
|
||||
@@ -1030,13 +_,19 @@
|
||||
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||
{
|
||||
|
||||
@@ -152,6 +152,12 @@ public final class WorldConfiguration extends ConfigurationPart {
|
||||
public boolean oldEnchantedGoldenApple = false;
|
||||
public boolean oldSoundsAndParticleEffects = false;
|
||||
public boolean fastHealthRegen = true;
|
||||
|
||||
@Comment(
|
||||
"The maximum damage a player can take in a single hit.\n" +
|
||||
"This can prevent arrows and maces instantly killing players."
|
||||
)
|
||||
public DoubleOr.Disabled maxDamage = DoubleOr.Disabled.DISABLED;
|
||||
public IntOr.Default maxArmourDamage = IntOr.Default.USE_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user