2023-10-29 01:25:46 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: booky10 <boooky10@gmail.com>
|
|
|
|
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
|
2023-11-04 21:20:13 +01:00
|
|
|
index 91919b2d06d544be9a09c486791de7dff599f75a..087898a50909a40aabec09f1e52cefed6565ba4c 100644
|
2023-10-29 01:25:46 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
2023-11-04 21:20:13 +01:00
|
|
|
@@ -3283,6 +3283,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
2023-10-29 01:25:46 +02:00
|
|
|
void increaseWardenWarningLevel();
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * The idle duration is reset when the player
|
|
|
|
+ * sends specific action packets.
|
|
|
|
+ * <p>
|
|
|
|
+ * 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.
|
|
|
|
+ * <p>
|
|
|
|
+ * 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();
|