From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: booky10 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/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 118ecb48f014539f18105a20bdebe2e03ee8e6f8..9f8d0242c00008432012319a95453a25c5ef761e 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3508,6 +3508,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM void increaseWardenWarningLevel(); // Paper end + // Paper start + /** + * The idle duration is reset when the player + * sends specific action packets. + *

+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the + * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. + * + * @return the current idle duration of this player + */ + @NotNull Duration getIdleDuration(); + + /** + * Resets this player's idle duration. + *

+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the + * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. + * + * @see #getIdleDuration() + */ + void resetIdleDuration(); + // Paper end + @NotNull @Override Spigot spigot();