testserver/patches/server/0262-Expose-attack-cooldown...

33 lines
1.4 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00: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
2021-07-07 06:52:40 +00:00
index 37d1d84d05812adb48e6116c0506f1d460de4038..abe7052b7b5c98328e4ecc1d199e911d5e9dcc2b 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2021-07-07 06:52:40 +00:00
@@ -2234,6 +2234,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2021-06-11 12:02:28 +00:00
connection.send(new net.minecraft.network.protocol.game.ClientboundOpenBookPacket(net.minecraft.world.InteractionHand.MAIN_HAND));
2021-07-07 06:52:40 +00:00
connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(0, stateId, slot, inventory.getSelected()));
2021-06-11 12:02:28 +00:00
}
+
2021-06-13 04:03:02 +00:00
+ @Override
2021-06-11 12:02:28 +00:00
+ public float getCooldownPeriod() {
2021-06-13 04:03:02 +00:00
+ return getHandle().getCurrentItemAttackStrengthDelay();
2021-06-11 12:02:28 +00:00
+ }
+
2021-06-13 04:03:02 +00:00
+ @Override
2021-06-11 12:02:28 +00:00
+ public float getCooledAttackStrength(float adjustTicks) {
+ return getHandle().getAttackStrengthScale(adjustTicks);
+ }
+
2021-06-13 04:03:02 +00:00
+ @Override
2021-06-11 12:02:28 +00:00
+ public void resetCooldown() {
+ getHandle().resetAttackStrengthTicker();
+ }
// Paper end
// Spigot start