Twi5TeD/PlayTime

Feature request: Please add an option to stop counting playtime when a user is afk.

Opened this issue · 4 comments

The title says it all. Please add an option to disable playtime-counting when being afk. If I have time I can try to do it myself.

not sure i can do it as im getting playtime from world folder. if your able to do it sure go ahead thanks

I'll try :)

have you had any luck?

nope. I didn't have much time the last few months because of school, work and my own projects in between. Minecraft plugins aren't my priority number one right now. Sorry.

You can probably achieve this by running a thread or a BukkitRunnable that checks who's online every minute and adds a minute of playtime to their entry. Storing playtime in a yml file shouldn't be to difficult if you aren't already doing that.
You can basically check, if a player's position changed compared to the last time they had playtime added. If not don't give them playtime. If you want to make it a little more complex but also disable playtime while in an afk pool you can make it check if a player has sent any mine / place packets in tge last minute and if not they're considered afk. That way people in afk pools don't get xp even when they're being moved by the water.