mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-19 00:55:42 +01:00
abca14ff96
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6f9fe1d9 #562: Add API to set equipment silently bcddb754 SPIGOT-6256: Add method to check if the entity is in water CraftBukkit Changes: 878b4375 #772: Add API to set equipment silently 22d7fcc9 SPIGOT-6256: Add method to check if the entity is in water
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 25af1a69317cda73fb93689c899fcee676ff5c95..97696e489413cb93bd12299a886b18152f32f522 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1830,7 +1830,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.getAttackCooldown(0F)).callEvent()) {
|
|
+ player.resetAttackCooldown();
|
|
+ }
|
|
+ } else {
|
|
+ ((EntityHuman) damagesource.getEntity()).resetAttackCooldown();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
if (event.isCancelled()) {
|
|
return false;
|