Any way to restart a server using a plugin?

Discussion in 'Spigot Plugin Development' started by AwesomeFishh, Jul 10, 2018.

  1. Hey everyone, I'm creating a Survivalgames plugin and after the Mini-game has ended, or when maintenance mode is disabled, I need the minigame to restart, but I can't find a way to do this anywhere. Anyone know how to do this?
     
  2. MiniDigger

    Supporter

  3. No... just no
     
  4. MiniDigger

    Supporter

    I posted the proper solution which involves writing even less chars.
    Pls don't suggest bad things to ppl when you know it's bad.
     
  5. 1. No.
    2. Bukkit.reload();
     
    • Funny Funny x 1
    • Optimistic Optimistic x 1
  6. MiniDigger

    Supporter

    Why do you both suggest reload when op wants restart? :confused:
     
    • Like Like x 1
    • Agree Agree x 1
  7. I'm definitely not suggesting reloading, but if OP wants to reload he shouldn't use Renamed his way, it was just to tell him that there's a better way to reload then dispatchCommand.
     
  8. Reload is horrible, bad practice don't get used to it.

    Just use the server restart/stop method, don't use system.exit(0)!
     
    • Agree Agree x 2
  9. You have to use scripts if you want to restart the server
     
  10. How I did it was use a loop in the start script and simply shutdown the server. The script will start the server back up for you.
     
  11. How I did it was put this in my run.bat

    :begin
    java -Xms1000M -Xmx2G -XX:MaxHeapSize=1000M -jar spigot.jar
    goto begin

    then i did
    Code (Text):
                     Bukkit.shutdown();
     
    • Funny Funny x 1