Credits:
[Only registered and activated users can see links. Click Here To Register...]
Well, most crashes happen somewhere within the main method of the server class.
I looked in it and noticed there was no try or catch, just a damn method.
How stupid can people be? Using restarters this whole time when they can just add an exception catch.
So, in the server class, go to your main method, and under the declaration, add a try block
Now, above the ending brace of the main method, end the try block and add a catch that just stops the clientHandler and listener, disconnects players, and starts everything up again.Code:try {
Heres what the catch should look like:
So now if a crashing exception is thrown from your main method in the server class, this should catch the exception, and make the server lag for about 5 seconds.Code:catch (Exception e) {
shutdownServer = true;
playerHandler.destruct();
clientHandler.killServer();
clientHandler = null;
main(null);
}
I'm not 100% sure this one would work, the other one caused memory leaks when it restarted.
It surprises me that nobody else has figured this out yet.
Please note that this will not stop all crashes, as crashes happen in several different places within servers, but this will stop most common crashes.
Quote:
Originally Posted by 400OakStreet [Only registered and activated users can see links. Click Here To Register...]
