Configurable damage tick when blocking with shield (#10877)

A long standing bug in spigot and its derivatives was the fact that
players taking damage while blocking with a shield would not receive
invulnerability, while they do in vanilla.

This enabled the pvp technique of disabling a shield and immediately
attacking again to knock a player into the air.
While upstream fixed this and properly aligned itself with vanilla
damage logic (in this specific case) changing such long standing
behaviour has some downsides.

To allow players used to this specific bug to still use it, this patch
introduces a configuration option to re-introduce said bug.
As there is no easy way to *only* re-add this bug, the option is found
in the unsupported section as it may introduce other damage related
disparity from vanilla.
This commit is contained in:
Bjarne Koll 2024-06-15 23:09:34 +02:00 committed by Bjarne Koll
parent d41636f445
commit 7df472527f
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
30 changed files with 29 additions and 8 deletions

View file

@ -487,10 +487,10 @@ index 0000000000000000000000000000000000000000..d9502ba028a96f9cc846f9ed428bd806
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..892351c3b6397b3cde6a31a6594c0e16bbe1252b
index 0000000000000000000000000000000000000000..7045040681e639f36fefcf2735f67367d5e3cbc4
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,311 @@
@@ -0,0 +1,313 @@
+package io.papermc.paper.configuration;
+
+import co.aikar.timings.MinecraftTimings;
@ -651,6 +651,8 @@ index 0000000000000000000000000000000000000000..892351c3b6397b3cde6a31a6594c0e16
+ public boolean performUsernameValidation = true;
+ @Comment("This setting controls if players should be able to create headless pistons.")
+ public boolean allowHeadlessPistons = false;
+ @Comment("This setting controls if the vanilla damage tick should be skipped if damage was blocked via a shield.")
+ public boolean skipVanillaDamageTickWhenShieldBlocked = false;
+ @Comment("This setting controls what compression format is used for region files.")
+ public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
+

View file

@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 892351c3b6397b3cde6a31a6594c0e16bbe1252b..ab5089781b8866cd6ad1b9570634ba84d936cfe7 100644
index 7045040681e639f36fefcf2735f67367d5e3cbc4..cc847dce0116b8260790b890b1d5452c280e186c 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -285,7 +285,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -287,7 +287,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

View file

@ -17,7 +17,7 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e
node = loader.load();
this.verifyGlobalConfigVersion(node);
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index ab5089781b8866cd6ad1b9570634ba84d936cfe7..4de88f74182bb596c6b5ad0351cc0dacefd0ce96 100644
index cc847dce0116b8260790b890b1d5452c280e186c..2a5453707bc172d8d0efe3f11959cb0b5f830984 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {

View file

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bjarne Koll <lynxplay101@gmail.com>
Date: Thu, 13 Jun 2024 17:16:01 +0200
Subject: [PATCH] Configurable damage tick when blocking with shield
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7a6c8a64bd119fd1f2fc245f84cbb332ecd937e3..45e5f14c3ad7cf25e11baa1554eb5fabac41ebe2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2380,7 +2380,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) damagesource.getEntity(), this, damagesource, originalDamage, f, true); // Paper - fix taken/dealt param order
}
- return true;
+ return !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.skipVanillaDamageTickWhenShieldBlocked; // Paper - this should always return true, however expose an unsupported setting to flip this to false to enable "shield stunning".
} else {
return true; // Paper - return false ONLY if event was cancelled
}

View file

@ -22118,7 +22118,7 @@ index 0d0cb3e63acd5156b6f9d6d78cc949b0af36a77b..dd1649abe57d7191c15a9b2862d5fd11
private ChunkSystem() {
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 4de88f74182bb596c6b5ad0351cc0dacefd0ce96..b4fa4259f66e449e754a70a7a99b9e68d9eb5016 100644
index 2a5453707bc172d8d0efe3f11959cb0b5f830984..b8499c1cea97a1a88a53053bc7da132f2fd3928d 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -22189,7 +22189,7 @@ index 4de88f74182bb596c6b5ad0351cc0dacefd0ce96..b4fa4259f66e449e754a70a7a99b9e68
public UnsupportedSettings unsupportedSettings;
public class UnsupportedSettings extends ConfigurationPart {
@@ -201,7 +225,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

View file

@ -26,7 +26,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7a6c8a64bd119fd1f2fc245f84cbb332ecd937e3..f35c9b1ee4bb99a4fad269b5f0cc46b8a1f3adfb 100644
index 45e5f14c3ad7cf25e11baa1554eb5fabac41ebe2..25a7dfddb44a11f6e20c459141a61270c0c12d4c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3743,7 +3743,7 @@ public abstract class LivingEntity extends Entity implements Attackable {