use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class MobDatabase method remove.
public void remove(ServerMob serverMob) {
Document document = database.getDocument("server_selector_mobs").getDocument("mobs").remove(serverMob.getUniqueId().toString());
database.insert(document);
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class MobDatabase method append.
public void append(ServerMob serverMob) {
Document document = database.getDocument("server_selector_mobs").getDocument("mobs").append(serverMob.getUniqueId().toString(), serverMob);
database.insert(document);
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class ConfigSignLayout method saveLayout.
public ConfigSignLayout saveLayout(de.dytanic.cloudnet.lib.serverselectors.sign.SignLayoutConfig signLayoutConfig) {
Document document = Document.loadDocument(path);
document.append("layout_config", signLayoutConfig);
document.saveAsConfig(path);
return this;
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class SignDatabase method appendSign.
public SignDatabase appendSign(Sign sign) {
Document x = database.getDocument("signs");
Document document = x.getDocument("signs");
document.append(sign.getUniqueId().toString(), sign);
database.insert(document);
return this;
}
use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.
the class PacketInCustomSubChannelMessage method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
DefaultType defaultType = data.getObject("defaultType", DefaultType.class);
String channel = data.getString("channel");
String message = data.getString("message");
Document document = data.getDocument("value");
if (defaultType.equals(DefaultType.BUKKIT)) {
if (data.contains("serverId")) {
MinecraftServer minecraftServer = CloudNet.getInstance().getServer(data.getString("serverId"));
if (minecraftServer != null) {
minecraftServer.sendPacket(new PacketOutCustomSubChannelMessage(channel, message, document));
return;
}
CloudServer cloudServer = CloudNet.getInstance().getCloudGameServer(data.getString("serverId"));
if (cloudServer != null) {
cloudServer.sendPacket(new PacketOutCustomSubChannelMessage(channel, message, document));
}
} else {
CloudNet.getInstance().getNetworkManager().sendAll(new PacketOutCustomSubChannelMessage(channel, message, document), new ChannelFilter() {
@Override
public boolean accept(INetworkComponent networkComponent) {
return networkComponent instanceof MinecraftServer || networkComponent instanceof CloudServer;
}
});
}
} else {
if (data.contains("serverId")) {
ProxyServer proxyServer = CloudNet.getInstance().getProxy(data.getString("serverId"));
if (proxyServer != null) {
proxyServer.sendPacket(new PacketOutCustomSubChannelMessage(channel, message, document));
}
} else {
CloudNet.getInstance().getNetworkManager().sendToProxy(new PacketOutCustomSubChannelMessage(channel, message, document));
}
}
}
Aggregations