Paper/patches/server/0260-Expose-attack-cooldown-methods-for-Player.patch

33 lines
1.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2022-03-01 04:00:17 +01:00
index 5897b067797af48a6c643c3a3db7d4b12ec6822f..f2fcfc12f4efd3317f3d6540f3b73f028b66d5ee 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2022-03-01 04:00:17 +01:00
@@ -2412,6 +2412,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers;
2021-06-11 14:02:28 +02:00
}
+
2021-06-13 06:03:02 +02:00
+ @Override
2021-06-11 14:02:28 +02:00
+ public float getCooldownPeriod() {
2021-06-13 06:03:02 +02:00
+ return getHandle().getCurrentItemAttackStrengthDelay();
2021-06-11 14:02:28 +02:00
+ }
+
2021-06-13 06:03:02 +02:00
+ @Override
2021-06-11 14:02:28 +02:00
+ public float getCooledAttackStrength(float adjustTicks) {
+ return getHandle().getAttackStrengthScale(adjustTicks);
+ }
+
2021-06-13 06:03:02 +02:00
+ @Override
2021-06-11 14:02:28 +02:00
+ public void resetCooldown() {
+ getHandle().resetAttackStrengthTicker();
+ }
// Paper end
// Spigot start
private final Player.Spigot spigot = new Player.Spigot()