Paper/Spigot-API-Patches/0147-Expose-attack-cooldown-methods-for-Player.patch
Aikar 2f34301581
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
7361a62e SPIGOT-5641: Add Block.getDrops(ItemStack, Entity)
1dc91b15 Add specific notes about what is not API
2b05ef88 #484: Allow statistics to be accessed for offline players

CraftBukkit Changes:
f7d6ad53 SPIGOT-5603: Use LootContext#lootingModifier in CraftLootTable
5838285d SPIGOT-5657: BlockPlaceEvent not cancelling for tripwire hooks
f325b9be SPIGOT-5641: Add Block.getDrops(ItemStack, Entity)
e25a2272 Fix some formatting in CraftHumanEntity
498540e0 Add Merchant slot delegate
b2de47d5 SPIGOT-5621: Add missing container types for opening InventoryView
aa3a2f27 #645: Allow statistics to be accessed for offline players
2122c0b1 #649: CraftBell should implement Bell
2020-04-08 03:49:15 -04:00

41 lines
1.3 KiB
Diff

From b319beedc36811afee1dff795c3a29f7644ac8a2 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Tue, 4 Sep 2018 15:01:54 -0500
Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c37d7fca0..3600b4c84 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1703,6 +1703,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param profile The new profile to use
*/
void setPlayerProfile(@NotNull PlayerProfile profile);
+
+ /**
+ * Returns the amount of ticks the current cooldown lasts
+ *
+ * @return Amount of ticks cooldown will last
+ */
+ float getCooldownPeriod();
+
+ /**
+ * Returns the percentage of attack power available based on the cooldown (zero to one).
+ *
+ * @param adjustTicks Amount of ticks to add to cooldown counter for this calculation
+ * @return Percentage of attack power available
+ */
+ float getCooledAttackStrength(float adjustTicks);
+
+ /**
+ * Reset the cooldown counter to 0, effectively starting the cooldown period.
+ */
+ void resetCooldown();
// Paper end
// Spigot start
--
2.25.1