Search in sources :

Example 6 with GameServer

use of de.dytanic.cloudnetwrapper.server.GameServer 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)

Example 7 with GameServer

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

the class CloudNetWrapper method onShutdownCentral.

@Override
public void onShutdownCentral() throws Exception {
    canDeployed = false;
    if (serverProcessQueue != null) {
        serverProcessQueue.getProxys().clear();
        serverProcessQueue.getServers().clear();
        serverProcessQueue.setRunning(false);
    }
    for (GameServer gameServer : servers.values()) gameServer.shutdown();
    for (BungeeCord gameServer : proxys.values()) gameServer.shutdown();
    proxyGroups.clear();
    serverGroups.clear();
    System.out.println("Wrapper try to connect to the CloudNet-Core");
    try {
        FileUtils.deleteDirectory(new File("temp"));
    } catch (Exception ex) {
    }
    new File("temp").mkdir();
    while (networkConnection.getChannel() == null) {
        networkConnection.tryConnect(optionSet.has("ssl"), new NetDispatcher(networkConnection, false), auth);
        if (networkConnection.getChannel() != null) {
            networkConnection.sendPacketSynchronized(new PacketOutUpdateWrapperInfo());
            break;
        }
        Thread.sleep(2000);
    }
    canDeployed = true;
    if (serverProcessQueue != null)
        serverProcessQueue.setRunning(true);
}
Also used : PacketOutUpdateWrapperInfo(de.dytanic.cloudnetwrapper.network.packet.out.PacketOutUpdateWrapperInfo) BungeeCord(de.dytanic.cloudnetwrapper.server.BungeeCord) NetDispatcher(de.dytanic.cloudnet.lib.network.NetDispatcher) CloudGameServer(de.dytanic.cloudnetwrapper.server.CloudGameServer) GameServer(de.dytanic.cloudnetwrapper.server.GameServer) File(java.io.File) IOException(java.io.IOException)

Aggregations

GameServer (de.dytanic.cloudnetwrapper.server.GameServer)7 CloudGameServer (de.dytanic.cloudnetwrapper.server.CloudGameServer)5 BungeeCord (de.dytanic.cloudnetwrapper.server.BungeeCord)4 ServerInfo (de.dytanic.cloudnet.lib.server.info.ServerInfo)2 File (java.io.File)2 IOException (java.io.IOException)2 TypeToken (com.google.gson.reflect.TypeToken)1 NetDispatcher (de.dytanic.cloudnet.lib.network.NetDispatcher)1 ProxyProcessMeta (de.dytanic.cloudnet.lib.server.ProxyProcessMeta)1 PacketOutUpdateWrapperInfo (de.dytanic.cloudnetwrapper.network.packet.out.PacketOutUpdateWrapperInfo)1