aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch')
-rw-r--r--patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch
new file mode 100644
index 0000000000..be9e57b2e3
--- /dev/null
+++ b/patches/server/0346-Add-PlayerAttackEntityCooldownResetEvent.patch
@@ -0,0 +1,29 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: nossr50 <[email protected]>
+Date: Thu, 26 Mar 2020 19:44:50 -0700
+Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+index 57528fce99102da6b3d0c3d9dbf9d2cd71375ff8..f2e66b50b32d197f9a8d4a9672ebf1413e66d59b 100644
+--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+@@ -2277,7 +2277,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
+ }
+
+ if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {
+- ((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
++ // Paper start - PlayerAttackEntityCooldownResetEvent
++ //((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
++ if (damagesource.getEntity() instanceof ServerPlayer) {
++ ServerPlayer player = (ServerPlayer) damagesource.getEntity();
++ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getAttackStrengthScale(0F)).callEvent()) {
++ player.resetAttackStrengthTicker();
++ }
++ } else {
++ ((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker();
++ }
++ // Paper end - PlayerAttackEntityCooldownResetEvent
+ }
+
+ // Resistance