use of de.dytanic.cloudnetwrapper.util.MasterTemplateDeploy in project CloudNet by Dytanic.
the class CloudGameServer method shutdown.
@Override
public boolean shutdown() {
if (instance == null) {
try {
FileUtils.deleteDirectory(dir.toFile());
} catch (IOException e) {
}
return true;
}
if (instance.isAlive()) {
executeCommand("stop");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
instance.destroyForcibly();
try {
Files.deleteIfExists(Paths.get(path + "/plugins/CloudNetAPI.jar"));
} catch (IOException e) {
}
if (CloudNetWrapper.getInstance().isCanDeployed()) {
MasterTemplateDeploy masterTemplateDeploy = new MasterTemplateDeploy(path, new ConnectableAddress(CloudNetWrapper.getInstance().getWrapperConfig().getCloudnetHost(), CloudNetWrapper.getInstance().getWrapperConfig().getWebPort()), CloudNetWrapper.getInstance().getSimpledUser(), CloudNetWrapper.getInstance().getOptionSet().has("ssl"), cloudServerMeta.getTemplate(), null, cloudServerMeta.getTemplateName());
try {
masterTemplateDeploy.deploy();
} catch (Exception e) {
}
}
try {
FileUtils.deleteDirectory(new File(path));
} catch (IOException e) {
}
CloudNetWrapper.getInstance().getCloudservers().remove(getServiceId().getServerId());
CloudNetWrapper.getInstance().getNetworkConnection().sendPacket(new PacketOutRemoveCloudServer(serverInfo));
System.out.println("Server " + toString() + " was stopped");
try {
this.finalize();
} catch (Throwable throwable) {
}
return true;
}
Aggregations