Where is on server crash event in sponge 8.0?

How can I detect that server is crash in sponge 8.0 ?

Please help me.

I dont think there is such a thing. So you may need to resort to the Java event.

Thread thead = Thread.currentThread();
thread.setUncaughtExceptionHandler((thread, exception) -> {
})

I have no idea if sponge already has something in place, if so i would wrap yours around sponge’s so it still triggers by getting it out of the thread and then running it in yours.

Also note that this will only be trigged for the thread you get, as mc should mostly be single threaded this shouldnt be too much of a issue … Depends what your trying to do.

It maybe worth creating a feature request of such thing as then it could be attached to sponge async delayed and repeating tasks too

1 Like

Thank for you care! I’ll test it!

1 Like

not working. It can’t handler on server crash.

Ill have a play around. But if you havent already, i would create a feature request

So small problem. I cant crash sponge vanilla, its built too well XD.

My only thought would be to launch the server using another program and then get the response of the turn off. If the response isnt 0 that means the server turned off due to something other than typing stop into a command.

1 Like