diff options
author | Jake Potrebic <[email protected]> | 2024-04-26 16:43:59 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-26 17:00:40 -0700 |
commit | c38f96b0e57ad28f444dad8d1c4d2f1fb6ea19cb (patch) | |
tree | 419c16734eadf2568b42f966a6fc3a7e16728397 /patches/server/0922-Add-player-idle-duration-API.patch | |
parent | 6a4974b1b96312b31383fca985c5d409b3939b42 (diff) | |
download | Paper-c38f96b0e57ad28f444dad8d1c4d2f1fb6ea19cb.tar.gz Paper-c38f96b0e57ad28f444dad8d1c4d2f1fb6ea19cb.zip |
deprecate our ItemRarity API
Diffstat (limited to 'patches/server/0922-Add-player-idle-duration-API.patch')
-rw-r--r-- | patches/server/0922-Add-player-idle-duration-API.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/patches/server/0922-Add-player-idle-duration-API.patch b/patches/server/0922-Add-player-idle-duration-API.patch new file mode 100644 index 0000000000..3aaeed1d13 --- /dev/null +++ b/patches/server/0922-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 8f92ff51647a1919d90219d0cab1710aa9ff7361..e2986f07a7f7a3f15275fa6366ebaaf65019036d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -3394,6 +3394,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; |