use of de.dytanic.cloudnet.lib.utility.threading.ScheduledTask 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);
}
use of de.dytanic.cloudnet.lib.utility.threading.ScheduledTask 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);
}
Aggregations