Private void AFKStop () {
new BukkitRunnable () {
@Override
public void run () {
if (Bukkit.getOnlinePlayers (). Size () == 0) {
Bukkit.shutdown ();
}
}
} .runTaskTimer ((plugin) this, 0, 6000);
}
What is the code doing? The server should be shut down if there's no player on it for 5 minutes.
In onEnable () {} is AFKStop (); registered. Relatively far down, but that doesn't matter. I've tried it.
You have to set the 0 to the number of ticks that should be waited for before the first check.
That's going to be done anyway. Even if I set the ticks higher, the server will shut down again after starting LOL
Ah wait a minute… May make sense xD
But then it is so that if the player after e.g. Leaves 4 minutes, the server is shut down after 1 minute, because then 5 minutes are up…
Yes, I would have solved it differently. Can I write to you afterwards during the lunch break?
All right, I already got a very helpful answer. See above