Paper/patches/server/0262-Expose-attack-cooldown-methods-for-Player.patch
2021-06-29 22:21:42 +01:00

33 lines
1.4 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 295f82fcdc42103e99bb5c0ab472388f83ac5646..96d924299f20f96fbf94b491da0ff3f692344334 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2233,6 +2233,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND));
connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, slot, inventory.getSelected()));
}
+
+ @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