mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Add player idle duration API
Implements API for getting and resetting a player's idle duration.
This commit is contained in:
parent
de8998e411
commit
2b6b81bde9
@ -3416,6 +3416,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
}
|
}
|
||||||
// Paper end
|
// 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()
|
public Player.Spigot spigot()
|
||||||
{
|
{
|
||||||
return this.spigot;
|
return this.spigot;
|
||||||
|
Loading…
Reference in New Issue
Block a user