Expose attack cooldown methods for Player (#1412)

This commit is contained in:
BillyGalbreath 2018-09-22 22:03:53 -05:00 committed by Daniel Ennis
parent fedb0c07ae
commit df72ca1321
29 changed files with 151 additions and 55 deletions

View file

@ -0,0 +1,40 @@
From b0307c1c84d01e61a96ad64b5153abd236229626 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 6da68835..ae2b9752 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1909,6 +1909,26 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* @param profile The new profile to use
*/
void setPlayerProfile(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.18.0

View file

@ -1,4 +1,4 @@
From bbd891e485ca3127eb1a6091021198f8e7f13b36 Mon Sep 17 00:00:00 2001
From 6656095685e81f278910780b8b8e7b6c196727d4 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:32:28 +0100
Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index ab9e81fd..a7b8f869 100644
index ab9e81fd2..a7b8f869c 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -8,10 +8,19 @@ import org.bukkit.inventory.ItemStack;

View file

@ -1,4 +1,4 @@
From 8441b5c4cf5d6774d9c65a809bcd6480a760d668 Mon Sep 17 00:00:00 2001
From 8c127ac73fee4c7ad71b7033b438fa109bc20415 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 9 Sep 2018 12:39:06 -0400
Subject: [PATCH] Mob Pathfinding API
@ -13,7 +13,7 @@ You can use EntityPathfindEvent to cancel new pathfinds from overriding your cur
diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
new file mode 100644
index 00000000..d6953b39
index 000000000..d6953b390
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
@@ -0,0 +1,167 @@
@ -185,7 +185,7 @@ index 00000000..d6953b39
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
index d029d34e..48eddcd3 100644
index d029d34ea..48eddcd30 100644
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -7,6 +7,14 @@ import org.bukkit.loot.Lootable;

View file

@ -1,4 +1,4 @@
From ebe3ab3a42a6d51c060849d75fdaba854bb6dc89 Mon Sep 17 00:00:00 2001
From 4f1fd57d2ea5113299a778d65853cf793a729cbb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 13 Sep 2018 20:51:50 -0400
Subject: [PATCH] Performance & Concurrency Improvements to Permissions
@ -110,5 +110,5 @@ index d4cb00a82..486f69f86 100644
}
--
2.18.0
2.19.0

View file

@ -1,4 +1,4 @@
From d18aff755cf3e94ecc7da5eff26a6cfb85d17163 Mon Sep 17 00:00:00 2001
From 72b028b971900862d0ef20993f92a5edb28774d4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 13 Sep 2018 21:39:26 -0400
Subject: [PATCH] Add ItemStackRecipeChoice Draft API
@ -65,5 +65,5 @@ index 000000000..43e6576b1
+ }
+}
--
2.18.0
2.19.0

View file

@ -1,4 +1,4 @@
From 22461a04950e5ef28f7cd61b5d28b091759234d0 Mon Sep 17 00:00:00 2001
From 9f579908896fe5bd40e8320205d51533aff8078b Mon Sep 17 00:00:00 2001
From: Tassu <git@tassu.me>
Date: Thu, 13 Sep 2018 08:45:01 +0300
Subject: [PATCH] Implement furnace cook speed multiplier API

View file

@ -1,4 +1,4 @@
From d9327f143f54e3033ee83fcda98323416dfc7325 Mon Sep 17 00:00:00 2001
From a8938a2fab6db83a3582928e8d967a12d64d39be Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 18 Sep 2018 23:50:10 +0100
Subject: [PATCH] PreSpawnerSpawnEvent
@ -10,7 +10,7 @@ spawners.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
new file mode 100644
index 00000000..d7221210
index 000000000..d72212105
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
@@ -0,0 +1,27 @@
@ -42,5 +42,5 @@ index 00000000..d7221210
+ }
+}
--
2.18.0.windows.1
2.19.0

View file

@ -1,4 +1,4 @@
From 4797cb3399e7aef4da06bce1cb8534f166a68992 Mon Sep 17 00:00:00 2001
From 04a41c887caf57c8e3572a7b42eac846a5af3315 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 22 Sep 2018 18:41:01 -0400
Subject: [PATCH] Remove Precondition on name for AttributeModifier