Search in sources :

Example 1 with CloudGameServer

use of de.dytanic.cloudnetwrapper.server.CloudGameServer in project CloudNet by Dytanic.

the class StopTimeHandler method run.

@Override
public void run(CloudNetWrapper wrapper) {
    for (GameServer gameServer : CloudNetWrapper.getInstance().getServers().values()) try {
        if (!gameServer.isAlive()) {
            if (System.currentTimeMillis() > (gameServer.getStartupTimeStamp() + 1600))
                gameServer.shutdown();
            else
                gameServer.restart();
        }
    } catch (Exception ex) {
    }
    for (CloudGameServer gameServer : CloudNetWrapper.getInstance().getCloudservers().values()) try {
        if (!gameServer.isAlive())
            gameServer.shutdown();
    } catch (Exception ex) {
    }
    for (BungeeCord bungeeCord : CloudNetWrapper.getInstance().getProxys().values()) try {
        if (!bungeeCord.isAlive())
            bungeeCord.shutdown();
    } catch (Exception ex) {
    }
}
Also used : CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer) BungeeCord(de.dytanic.cloudnetwrapper.server.BungeeCord) CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer) GameServer(de.dytanic.cloudnetwrapper.server.GameServer)

Example 2 with CloudGameServer

use of de.dytanic.cloudnetwrapper.server.CloudGameServer in project CloudNet by Dytanic.

the class ServerProcessQueue method patchAsync.

public void patchAsync(CloudServerMeta cloudServerMeta) {
    CloudGameServer cloudGameServer = new CloudGameServer(cloudServerMeta);
    TaskScheduler.runtimeScheduler().schedule(new Runnable() {

        @Override
        public void run() {
            try {
                cloudGameServer.bootstrap();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer)

Example 3 with CloudGameServer

use of de.dytanic.cloudnetwrapper.server.CloudGameServer in project CloudNet by Dytanic.

the class CloudNetWrapper method shutdown.

@Override
public boolean shutdown() {
    if (!RUNNING)
        return false;
    System.out.println("Wrapper shutdown...");
    TaskScheduler.runtimeScheduler().shutdown();
    if (scheduler != null)
        scheduler.cancelAllTasks();
    if (serverProcessQueue != null)
        serverProcessQueue.setRunning(false);
    for (GameServer gameServer : servers.values()) gameServer.shutdown();
    for (BungeeCord gameServer : proxys.values()) gameServer.shutdown();
    for (CloudGameServer gameServer : cloudservers.values()) gameServer.shutdown();
    this.cloudNetLogging.shutdownAll();
    if (networkConnection.getChannel() != null)
        networkConnection.tryDisconnect();
    try {
        FileUtils.deleteDirectory(new File("temp"));
    } catch (IOException e) {
    }
    System.out.println("\n    _  _     _______   _                       _          \n" + "  _| || |_  |__   __| | |                     | |         \n" + " |_  __  _|    | |    | |__     __ _   _ __   | | __  ___ \n" + "  _| || |_     | |    | '_ \\   / _` | | '_ \\  | |/ / / __|\n" + " |_  __  _|    | |    | | | | | (_| | | | | | |   <  \\__ \\\n" + "   |_||_|      |_|    |_| |_|  \\__,_| |_| |_| |_|\\_\\ |___/\n" + "                                                          \n" + "                                                          ");
    RUNNING = false;
    if (x_bnosxo)
        System.exit(0);
    return true;
}
Also used : CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer) BungeeCord(de.dytanic.cloudnetwrapper.server.BungeeCord) IOException(java.io.IOException) CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer) GameServer(de.dytanic.cloudnetwrapper.server.GameServer) File(java.io.File)

Aggregations

CloudGameServer (de.dytanic.cloudnetwrapper.server.CloudGameServer)3 BungeeCord (de.dytanic.cloudnetwrapper.server.BungeeCord)2 GameServer (de.dytanic.cloudnetwrapper.server.GameServer)2 File (java.io.File)1 IOException (java.io.IOException)1