Delay server shutdown

Discussion in 'Plugin Development' started by brord, Jun 6, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    brord

    Hello people!

    For my plugin, i want everyone to be informed when the server shuts down.
    I currently just broadcast a message, do certain actions like teleporting, and then make the main thread be suck with a

    long now = System.currentTimeMillis();
    while ((System.currentTimeMillis() - now) < 5000){}

    But this will cause the world not to load, so teleportation wont work.

    I thought of a way to detect the stop command, cancel it, and resend it in 10 seconds or so.

    Bbut this would seem too much for just a delay.

    Does anyone have any advice on how to do this the proper way?

    Thanks in advance!
     
  2. Offline

    Minnymin3

    Instead I'd just completely override the stop command by registering it as a new command like you would do any command (I did this with the enchant command) and make runnables to do stuff and delay the shutdown with a runnable (you can do getServer().shutdown() I think)
     
Thread Status:
Not open for further replies.

Share This Page