The Server Inactivity-Shutdown Plugin
Is your server often empty, desolate, and have several blocky tumble weeds rolling across it? Do you not want to keep it running when it is in this start, but you still want it up and running when people are on?
Fear not! For ServerSleeper is here!
ServerSleeper shuts down your server after a period of inactivity, configured by you! It's that simple!
How it works
ServerSleeper checks every minute if someone is on the server. If not, that's another minute the server is considered "inactive". After so many minutes, the plugin will simply shut down the server.
The configuration file is quite simple:
- timeout - This is how long you want ServerSleeper to wait on an inactive server before shutting it down. This value can be a standard time (1:40 meaning 1 hour and 40 minutes), or you can use "h" and "m" after numbers to denote the values (1h 40m). A straight number will be considered minutes.
ServerSleeper can do a few other things on top of that!
/sleeper postpone 00:00
- This command will postpone the inactivity counter. This means the plugin will wait this much longer, in addition to inactivity time, before putting the server to sleep. Use this to keep the server running longer than usual, even if no one is on!
/sleeper sleep 00:00
- This command will put the plugin into "timer mode". In this mode, the plugin will count down the time you put in and then shutdown the server, regardless of inactivity! It's like the sleep function on your TV or your iPod! (The postpone command will also postpone the timer mode)
/sleeper timeout 00:00
- This command will set the timeout property temporarily (it doesn't save it to the configuration file).
- This resets all timers and counters to 0.
- This command reloads the configuration file, but doesn't reset the timers and counters.
- Since these commands should only be executed by server admins and Ops, there is only one permission. Give this to those who you want to control server sleeper!
Since I am the developer of Commander, this plugin has a Commander EVM, with the namespace "plugin.ServerSleeper". (Note: Commander is not required for this plugin to work.) Valid Environment Variables from Commander are:
- plugin.ServerSleeper.mode - Returns the current mode: "inactive" or "timer"
- plugin.ServerSleeper.mode.inactive - Returns true if currently in inactive (or "normal") mode.
- plugin.ServerSleeper.mode.timer - Returns true if currently in timer (or "sleep") mode.
- plugin.ServerSleeper.mode.inactive.timeout - Returns the number of minutes must pass before the server shuts down. Returns 0 if in timer mode.
- plugin.ServerSleeper.mode.inactive.inactive - Returns the number of minutes that have passed currently with no one on the server. Returns 0 if in timer mode.
- plugin.ServerSleeper.mode.timer.timeout - Returns the number of minutes remaining before the server shuts down. Returns 0 if in inactive mode.
- plugin.ServerSleeper.time-till.shutdown - Returns how many minutes remain until the server will be shutdown.
Say, you want to start the server back up again after someone tries to get on? Check out MCSignOnDoor, also by me! It recently gained a "Sentry Mode"! Players who attempt to log into a server armed with a Sign On Door in Sentry Mode will shut down the Sign On Door and start the server back up! This plugin was made to work with McSod's sentry mode! Go check it out!
- Optional dependency