29 lines
1.9 KiB
Diff
29 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 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/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index cee156e0847af3187de8a7c9bc0791dff3886b15..d4451116215b0a396fc536fac992e962b3e8a100 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1820,7 +1820,16 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
|
if (damagesource.getEntity() instanceof EntityHuman) {
|
|
- ((EntityHuman) damagesource.getEntity()).resetAttackCooldown(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
|
+ // Paper start - PlayerAttackEntityCooldownResetEvent
|
|
+ if (damagesource.getEntity() instanceof EntityPlayer) {
|
|
+ EntityPlayer player = (EntityPlayer) damagesource.getEntity();
|
|
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getCooledAttackStrength(0F)).callEvent()) {
|
|
+ player.resetCooldown();
|
|
+ }
|
|
+ } else {
|
|
+ ((EntityHuman) damagesource.getEntity()).resetCooldown();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
if (event.isCancelled()) {
|
|
return false;
|