aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0949-Add-player-idle-duration-API.patch
diff options
context:
space:
mode:
authorTonytheMacaroni <[email protected]>2024-03-20 17:33:34 -0400
committerGitHub <[email protected]>2024-03-20 22:33:34 +0100
commit41ffa0cf8c26f6137a0d21d45067fee6d5896edf (patch)
treee69ade6383d83730724af6dff5145093716c9529 /patches/server/0949-Add-player-idle-duration-API.patch
parentde620b8480372e2896633f36e04e15dd01443265 (diff)
downloadPaper-41ffa0cf8c26f6137a0d21d45067fee6d5896edf.tar.gz
Paper-41ffa0cf8c26f6137a0d21d45067fee6d5896edf.zip
Expose power on fireballs (#10302)
Diffstat (limited to 'patches/server/0949-Add-player-idle-duration-API.patch')
-rw-r--r--patches/server/0949-Add-player-idle-duration-API.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/patches/server/0949-Add-player-idle-duration-API.patch b/patches/server/0949-Add-player-idle-duration-API.patch
new file mode 100644
index 0000000000..717b1d7291
--- /dev/null
+++ b/patches/server/0949-Add-player-idle-duration-API.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: booky10 <[email protected]>
+Date: Sat, 14 Oct 2023 03:11:11 +0200
+Subject: [PATCH] Add player idle duration API
+
+Implements API for getting and resetting a player's idle duration.
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+index 5b5167947c82ca66a89aab456a2eb5b523887d33..ff3db4efd2c10b3351453656937e88064267fb22 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+@@ -3337,6 +3337,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+ }
+ // Paper end
+
++ // Paper start
++ @Override
++ public Duration getIdleDuration() {
++ return Duration.ofMillis(net.minecraft.Util.getMillis() - this.getHandle().getLastActionTime());
++ }
++
++ @Override
++ public void resetIdleDuration() {
++ this.getHandle().resetLastActionTime();
++ }
++ // Paper end
++
+ public Player.Spigot spigot()
+ {
+ return this.spigot;