Page 1 of 1

Is there a message/event that gets sent on shutdown?

Posted: 20 Jul 2009, 18:38
by flarb
As far as I can tell, there is no event that is fired off when you initiiate a server restart/shutdown via the console or admin panel. I want to display a warning message in the game when I initiate a server shutdown. I figured it would be cool if there was an internalevent in the server plug-in and then I'd just send a message to all attached clients that the game is shutting down when this event is fired off. Is this not possible? If not, can you add it?


Posted: 20 Jul 2009, 21:31
by flarb

I think the shutdown feature needs a bit of extras.

Firstly, is there a way to make the shutdown happen over a longer period than 10 seconds?

I think that the shutdown feature from the command line and admin console needs to do a few things:

* Specify a time for shutdown (10 seconds, 30, seconds, a minute, etc.)

* Send an admin message at a certain interval over that time it will send out a message that says "the server will be shutting down in 30 seconds..." then "10 seconds" etc.

* Have an internal event for all plug-ins when the server is about to shut down. That way they can save out any info they need etc.

A lot of this can be done with the scheduling API--so I think that at the very least we need the ability to set the time interval of the shut down event through the command line and admin panel, and then a special internalevent for shutdown to do any plug-in specific processing.

Posted: 20 Jul 2009, 22:27
by flarb
Oh also---it would be great if CanLogin in the extension helper interface would always return false if the server is set to be shut down.

Re: Is there a message/event that gets sent on shutdown?

Posted: 15 Jun 2015, 04:35
by Flying_Banana
I'm also interested on whether there is a method of detecting server shutdown.

I need an entry point to perform some tasks before server shutdown, like closing database connections, saving some data, etc. Is there a workaround?

Re: Is there a message/event that gets sent on shutdown?

Posted: 15 Jun 2015, 07:20
by Lapo
all you need is adding a "shutdown hook" to the JVM so that it is executed prior to shut down.
We have discussed this already in several places.

See here: