Paper/patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch
Jake Potrebic afe633df08
convert API/server tests to mockito (#8848)
* convert API tests to mockito

* convert server tests to mockito

* add co-author
2023-02-15 13:27:40 -08:00

33 lines
1.2 KiB
Diff

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 6bec3eb7180ef24c5c1480acd35ca43fdd4e6c3e..8ce3558e154f332040e260c7fc8b2353895237c2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2672,6 +2672,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()