mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 15:17:17 +01:00
29 lines
2 KiB
Diff
29 lines
2 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index cf18f17f181bc94a2b5f4ac6926c2388ec3178c8..42c4adabe451cd32aa362075395a9fcc384ea788 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
|