aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0285-Expose-attack-cooldown-methods-for-Player.patch
blob: 9494e8d803b8357bd8c35ab56b1ee156a08ae44c (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
33
34
35
36
37
38
39
40
41
42
43
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/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 073faedf0c4fcf9e46be17b3a25d6467c2f1f880..fa656a424cebe42f12c3f8ecf82204e9d837c868 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -2006,6 +2006,7 @@ public abstract class EntityHuman extends EntityLiving {
         this.datawatcher.set(EntityHuman.bs, nbttagcompound);
     }
 
+    public float getCooldownPeriod() { return this.eR(); } // Paper - OBFHELPER
     public float eR() {
         return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D);
     }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 59b3baaa84c2f1db2d17c677c9eb0299b1494329..585e1b6de2a513a3c360e283ade360ed191cd643 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1977,6 +1977,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
         getInventory().setItemInMainHand(hand);
     }
 
+    // Paper start
+    public float getCooldownPeriod() {
+        return getHandle().getCooldownPeriod();
+    }
+
+    public float getCooledAttackStrength(float adjustTicks) {
+        return getHandle().getAttackCooldown(adjustTicks);
+    }
+
+    public void resetCooldown() {
+        getHandle().resetAttackCooldown();
+    }
+    // Paper end
+
     // Spigot start
     private final Player.Spigot spigot = new Player.Spigot()
     {