use of de.dytanic.cloudnetwrapper.network.packet.out.PacketOutRemoveProxy in project CloudNet by Dytanic.
the class BungeeCord method shutdown.
@Override
public boolean shutdown() {
if (instance == null) {
if (proxyGroup.getProxyGroupMode().equals(ProxyGroupMode.DYNAMIC)) {
try {
Files.delete(Paths.get(path));
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
}
if (instance.isAlive()) {
executeCommand("end");
NetworkUtils.sleepUninterruptedly(500);
}
instance.destroyForcibly();
if (CloudNetWrapper.getInstance().getWrapperConfig().isSavingRecords()) {
try {
FileCopy.copyFilesInDirectory(new File(path), new File("local/records/" + proxyProcessMeta.getServiceId().toString()));
new Document("meta", proxyProcessMeta).saveAsConfig(Paths.get("local/records/metadata.json"));
} catch (IOException e) {
e.printStackTrace();
}
}
if (proxyGroup.getProxyGroupMode().equals(ProxyGroupMode.DYNAMIC)) {
try {
FileUtils.deleteDirectory(new File(path));
} catch (IOException e) {
}
}
CloudNetWrapper.getInstance().getProxys().remove(getServiceId().getServerId());
CloudNetWrapper.getInstance().getNetworkConnection().sendPacket(new PacketOutRemoveProxy(proxyInfo));
System.out.println("Proxy " + toString() + " was stopped");
try {
this.finalize();
} catch (Throwable throwable) {
}
return true;
}
Aggregations