use of de.dytanic.cloudnet.lib.server.ServerProcessMeta in project CloudNet by Dytanic.
the class PacketInAddServer method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
if (!(packetSender instanceof Wrapper))
return;
Wrapper cn = ((Wrapper) packetSender);
ServerInfo nullServerInfo = data.getObject("serverInfo", new TypeToken<ServerInfo>() {
}.getType());
ServerProcessMeta serverProcessMeta = data.getObject("serverProcess", new TypeToken<ServerProcessMeta>() {
}.getType());
MinecraftServer minecraftServer = new MinecraftServer(serverProcessMeta, cn, CloudNet.getInstance().getServerGroups().get(nullServerInfo.getServiceId().getGroup()), nullServerInfo);
cn.getServers().put(nullServerInfo.getServiceId().getServerId(), minecraftServer);
cn.getWaitingServices().remove(minecraftServer.getServerId());
{
if (serverProcessMeta.isPriorityStop()) {
ServerGroup serverGroup = CloudNet.getInstance().getServerGroups().get(serverProcessMeta.getServiceId().getGroup());
if (serverGroup != null) {
PriorityStopTask priorityStopTask = new PriorityStopTask(cn, minecraftServer, serverGroup.getPriorityService().getStopTimeInSeconds());
ScheduledTask scheduledTask = CloudNet.getInstance().getSubScheduler().runTaskRepeatSync(priorityStopTask, 0, 50);
priorityStopTask.setScheduledTask(scheduledTask);
}
}
}
CloudNet.getInstance().getNetworkManager().handleServerAdd(minecraftServer);
}
use of de.dytanic.cloudnet.lib.server.ServerProcessMeta in project CloudNet by Dytanic.
the class PacketInStartServer method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
ServerProcessMeta serverProcessMeta = data.getObject("serverProcess", new TypeToken<ServerProcessMeta>() {
}.getType());
if (!data.contains("async")) {
System.out.println("Server process is now in queue [" + serverProcessMeta.getServiceId() + "]");
CloudNetWrapper.getInstance().getServerProcessQueue().putProcess(serverProcessMeta);
} else {
CloudNetWrapper.getInstance().getServerProcessQueue().patchAsync(serverProcessMeta);
}
}
Aggregations