aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch
blob: 2b4d1222f5d1661ff56301b52c68b2361bd70e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Tue, 4 Sep 2018 15:02:00 -0500
Subject: [PATCH] Expose attack cooldown methods for Player


diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ddf089d73a05792d99a96bb449717d82755f5cd9..27d29187b5471fa9d1588b7e8e35539be8a861a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2897,6 +2897,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
 
         return this.adventure$pointers;
     }
+
+    @Override
+    public float getCooldownPeriod() {
+        return getHandle().getCurrentItemAttackStrengthDelay();
+    }
+
+    @Override
+    public float getCooledAttackStrength(float adjustTicks) {
+        return getHandle().getAttackStrengthScale(adjustTicks);
+    }
+
+    @Override
+    public void resetCooldown() {
+        getHandle().resetAttackStrengthTicker();
+    }
     // Paper end
     // Spigot start
     private final Player.Spigot spigot = new Player.Spigot()