Search the Community
Showing results for tags 'hook'.
Found 2 results
-
[B]Time to make myself look like a right noob[/B] [MENTION=198095]falconpunch[/MENTION] ShutDownHook Class: [CODE]package core.util; import java.io.IOException; import server.game.players.Client; import server.Server; import server.game.players.PlayerHandler; public class ShutDownHook extends Thread { [MENTION=15855]Over[/MENTION]ride public void run() { System.out.println("[RunePwn] Anti-Roll Back Prevention.."); for (int j = 0; j < PlayerHandler.players.length; j++) { if (PlayerHandler.players[j] != null) { Client c = (Client)PlayerHandler.players[j]; server.game.players.PlayerSave.saveGame(c); } } System.out.println("[RunePwn] Server Crashed.. Restarting.."); try { Server.main(null); } catch (NullPointerException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }[/CODE] [B]Explanation:[/B] I am trying to make it automatically restart the server once it crashes, so then if worse comes to worst I don't have to worry about downtime. I have done this so far, got it all good no errors etc. But when I test the hook, It trys restarting the server before the previous prompt finishes. So it then says bind error etc, port already in use blah blah blah... I'm not in the thinking or coding mood tonight so I thought i'd just post it here like a noob haha. Someone let me know if you have any ideas on how to fix this shit. I was thinking make a new class and make it like run a method from it once the server is offline. For example... [CODE]System.out.printLn("Server Crashed, Restarting..."); newclass.Run(); System.exit(0); Maybe?? [/CODE] Please let me know your thoughts..
-
Do you think the Sandy Hook shooting was a hoax? After watching this video what are your thought's and opinions pertained to this? [video=youtube;-mlszDIRZb0]http://www.youtube.com/watch?v=-mlszDIRZb0[/video]