use of de.dytanic.cloudnetcore.network.components.Wrapper 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.cloudnetcore.network.components.Wrapper in project CloudNet by Dytanic.
the class PacketInAddProxy method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
if (!(packetSender instanceof Wrapper))
return;
Wrapper cn = ((Wrapper) packetSender);
ProxyInfo nullServerInfo = data.getObject("proxyInfo", new TypeToken<ProxyInfo>() {
}.getType());
ProxyProcessMeta proxyProcessMeta = data.getObject("proxyProcess", new TypeToken<ProxyProcessMeta>() {
}.getType());
ProxyServer minecraftServer = new ProxyServer(proxyProcessMeta, cn, nullServerInfo);
cn.getProxys().put(proxyProcessMeta.getServiceId().getServerId(), minecraftServer);
cn.getWaitingServices().remove(minecraftServer.getServerId());
CloudNet.getInstance().getNetworkManager().handleProxyAdd(minecraftServer);
}
use of de.dytanic.cloudnetcore.network.components.Wrapper 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.cloudnetcore.network.components.Wrapper in project CloudNet by Dytanic.
the class PacketInEnableScreen method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
if (!(packetSender instanceof Wrapper))
return;
ServiceId serviceId = data.getObject("serviceId", new TypeToken<ServiceId>() {
}.getType());
CloudNet.getInstance().getScreenProvider().handleEnableScreen(serviceId, ((Wrapper) packetSender));
}
use of de.dytanic.cloudnetcore.network.components.Wrapper in project CloudNet by Dytanic.
the class PacketInRemoveCloudServer method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
if (!(packetSender instanceof Wrapper))
return;
Wrapper cn = (Wrapper) packetSender;
ServerInfo serverInfo = data.getObject("serverInfo", new TypeToken<ServerInfo>() {
}.getType());
if (cn.getServers().containsKey(serverInfo.getServiceId().getServerId())) {
CloudServer minecraftServer = cn.getCloudServers().get(serverInfo.getServiceId().getServerId());
if (minecraftServer.getChannel() != null) {
minecraftServer.getChannel().close().syncUninterruptibly();
}
cn.getCloudServers().remove(serverInfo.getServiceId().getServerId());
CloudNet.getInstance().getNetworkManager().handleServerRemove(minecraftServer);
}
}
Aggregations