papermc/Spigot-Server-Patches/0489-Add-PlayerAttackEntityCooldownResetEvent.patch

26 lines
1.2 KiB
Diff

From b0175164c105ef071144d0facc5381c77974ac9d Mon Sep 17 00:00:00 2001
From: nossr50 <nossr50@gmail.com>
Date: Thu, 26 Mar 2020 19:44:50 -0700
Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 8a3f2b5e..2e186134 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1057,7 +1057,11 @@ public abstract class EntityHuman extends EntityLiving {
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
- this.ey();
+ // Paper start - PlayerAttackEntityCooldownResetEvent
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent((Player) this.getBukkitEntity(), entity.getBukkitEntity(), this.getCooledAttackStrength(0F)).callEvent()) {
+ this.resetCooldown(); // reset it like normal
+ }
+ // Paper end
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
--
2.25.1.windows.1