Hello! Today i was searching for plugins that will autostart your minecraft server if its down (I use a server host, not my computer) and i cannot find one. So, what I'm asking, is if anyone knows an existing plugin (Give me link if so), that does what i need, or if someone can make me this plugin. Thanks and have a nice day. -zIceGod
Just saying, there is no way to make a plugin like that because for a plugin to work the server has to be up
@iceblue1188 @timtower On the contrary, this is possible... Just very tricky. It is possible to launch an independent process from a java process, which could go and restart the server. The only questions would be: Where to launch from? When to launch, is there a bukkit crash event or something? How to prevent launching on a reload?
@iceblue1188 there is some stuff you can add on the run file and i think also rtoolkit does something not sure if its still around anymore though hope this helps
@iceblue1188, if I remember correctly spigot added a functionality to start a program as the server finished shutting down, but Bukkit has no such function. The only possibility I can see is having the onDisable method initiate an external program with a delay to account for the server shutting down, but that still isn't really a plugin. Also, as @meguy26 said, there is no way to distinguish a reload from restart.
@Tecno_Wizard I recently discovered shutdown hooks, and used them to start a program after/while the server was stopping. Apparently this auto restart thing is more possible than I thought.
@meguy26 Hmm. Could you send me the link to the source when you're done? I'm interested to see how this is done.
@Tecno_Wizard Source for what? Also, if your talking about shutdown hooks, they are incredibly easy, just get the Runtime object, an call Runtim#addShutdownHook(); addShutdownHook accepts a thread object, that is not yet started.
@meguy26 @Tecno_Wizard How ever it would be impossible to keep the server stopped because a new one would always be starting.
That was sitting in the back of my head but I wasn't sure if it was necessary to bring up. Yeah, that would be an issue.