diff options
author | maxcom1 <[email protected]> | 2024-03-23 22:26:17 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-23 17:26:17 -0400 |
commit | b6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch) | |
tree | a8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0948-Add-player-idle-duration-API.patch | |
parent | 9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff) | |
download | Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip |
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0948-Add-player-idle-duration-API.patch')
-rw-r--r-- | patches/server/0948-Add-player-idle-duration-API.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/patches/server/0948-Add-player-idle-duration-API.patch b/patches/server/0948-Add-player-idle-duration-API.patch new file mode 100644 index 0000000000..717b1d7291 --- /dev/null +++ b/patches/server/0948-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; |