package org.stevewinfield.suja.idk.dedicated.commands.defaults;

import org.apache.log4j.Logger;
import org.stevewinfield.suja.idk.Bootloader;
import org.stevewinfield.suja.idk.dedicated.commands.IDedicatedServerCommand;

public class StopCommand implements IDedicatedServerCommand {

    @Override
    public void execute(String[] args, Logger logger) {
        logger.info("Stopping server...");
        Bootloader.exitServer(0);
    }

    @Override
    public String getName() {
        return "stop";
    }
}

@@ -213,16 +213,135 @@
 Command;
+%0Aimport org.stevewinfield.suja.idk.game.rooms.RoomInstance;%0Aimport org.stevewinfield.suja.idk.network.sessions.Session;
 %0A%0Apublic
@@ -510,16 +510,460 @@
 r...%22);%0A
+        int i = 0;%0A        for (final Session session : Bootloader.getSessionManager().getSessions()) %7B%0A            session.disconnect();%0A            i++;%0A        %7D%0A        logger.info(i + %22 User(s) was/were kicked.%22);%0A        i = 0;%0A        for (final RoomInstance room : Bootloader.getGame().getRoomManager().getLoadedRoomInstances()) %7B%0A            room.save();%0A            i++;%0A        %7D%0A        logger.info(i + %22 Room(s) was/were saved.%22);%0A
         

Save users and rooms before exiting the Server.