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()
{