use of de.dytanic.cloudnet.lib.cloudserver.CloudServerMeta in project CloudNet by Dytanic.
the class PacketInStartCloudServer method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
CloudServerMeta cloudServerMeta = data.getObject("cloudServerMeta", new TypeToken<CloudServerMeta>() {
}.getType());
if (!data.contains("async")) {
System.out.println("Cloud game server process is now in queue [" + cloudServerMeta.getServiceId() + "]");
CloudNetWrapper.getInstance().getServerProcessQueue().putProcess(cloudServerMeta);
} else {
CloudNetWrapper.getInstance().getServerProcessQueue().patchAsync(cloudServerMeta);
}
}
use of de.dytanic.cloudnet.lib.cloudserver.CloudServerMeta in project CloudNet by Dytanic.
the class PacketInAddCloudServer 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());
CloudServerMeta serverProcessMeta = data.getObject("cloudServerMeta", new TypeToken<CloudServerMeta>() {
}.getType());
CloudServer minecraftServer = new CloudServer(cn, nullServerInfo, serverProcessMeta);
cn.getCloudServers().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);
}
Aggregations