use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class StatisticManager method addStartup.
public void addStartup() {
if (!statistic)
return;
Document document = database.getDocument(NAME);
if (!document.contains("cloudStartup")) {
document.append("cloudStartup", 0L);
}
document.append("cloudStartup", document.getLong("cloudStartup") + 1L);
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class StatisticManager method wrapperConnections.
public void wrapperConnections() {
if (!statistic)
return;
Document document = database.getDocument(NAME);
if (!document.contains("wrapperConnections")) {
document.append("wrapperConnections", 0);
}
document.append("wrapperConnections", document.getLong("wrapperConnections") + 1L);
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class PacketAPIInGetPlayers method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
Packet packet = getResult(new Document().append("players", CloudNet.getInstance().getNetworkManager().getOnlinePlayers().values()));
packetSender.sendPacket(packet);
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class CommandInstallPlugin method onExecuteCommand.
@Override
public void onExecuteCommand(CommandSender sender, String[] args) {
switch(args.length) {
case 3:
MinecraftServer minecraftServer = CloudNet.getInstance().getServer(args[0]);
if (minecraftServer != null && minecraftServer.getChannel() != null) {
minecraftServer.sendCustomMessage("cloudnet_internal", "install_plugin", new Document("name", args[1]).append("url", args[2]));
sender.sendMessage("Plugin will install on " + args[0] + "...");
} else {
sender.sendMessage("Server doesn't exist");
}
break;
default:
sender.sendMessage("installplugin <server> <name> <url>");
break;
}
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class CloudPriorityGroupStartupHandler method onHandle.
@Override
public void onHandle(CloudNet cloudNet) {
for (ServerGroup group : CloudNet.getInstance().getServerGroups().values()) {
double onlineCount = CloudNet.getInstance().getOnlineCount(group.getName());
if (group.getPriorityService().getGroup().getOnlineServers() == 0 || group.getPriorityService().getGlobal().getOnlineCount() == 0 || group.getGroupMode() == ServerGroupMode.STATIC || group.isMaintenance())
continue;
double priority = (group.getPriorityService().getGroup().getOnlineServers() / ((double) group.getPriorityService().getGroup().getOnlineCount())) * (onlineCount == 0 ? 1.0D : (onlineCount));
Collection<String> servers = CloudNet.getInstance().getServersAndWaitings(group.getName());
if (servers.size() == 0 && servers.size() < (priority <= 1 ? 1 : priority)) {
CloudNet.getInstance().startGameServer(group);
continue;
}
if (servers.size() < (priority <= 1 ? 1 : priority)) {
CloudNet.getInstance().startGameServer(group, new Document(), true);
}
}
}
Aggregations