Add player idle duration API

Implements API for getting and resetting a player's idle duration.
This commit is contained in:
booky10 2023-10-14 03:11:11 +02:00
parent 3c50e35f30
commit 2fccf1c185

View File

@ -3782,6 +3782,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.
* <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();