Search in sources :

Example 31 with Document

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);
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 32 with 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);
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 33 with 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;
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document)

Example 34 with Document

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;
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 35 with Document

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));
        }
    }
}
Also used : ChannelFilter(de.dytanic.cloudnetcore.network.components.util.ChannelFilter) PacketOutCustomSubChannelMessage(de.dytanic.cloudnetcore.network.packet.out.PacketOutCustomSubChannelMessage) INetworkComponent(de.dytanic.cloudnetcore.network.components.INetworkComponent) DefaultType(de.dytanic.cloudnet.lib.DefaultType) CloudServer(de.dytanic.cloudnetcore.network.components.CloudServer) Document(de.dytanic.cloudnet.lib.utility.document.Document) MinecraftServer(de.dytanic.cloudnetcore.network.components.MinecraftServer) ProxyServer(de.dytanic.cloudnetcore.network.components.ProxyServer)

Aggregations

Document (de.dytanic.cloudnet.lib.utility.document.Document)69 DatabaseDocument (de.dytanic.cloudnet.lib.database.DatabaseDocument)26 TypeToken (com.google.gson.reflect.TypeToken)7 ArrayList (java.util.ArrayList)7 File (java.io.File)6 UUID (java.util.UUID)6 OfflinePlayer (de.dytanic.cloudnet.lib.player.OfflinePlayer)5 ServerGroup (de.dytanic.cloudnet.lib.server.ServerGroup)5 ServerConfig (de.dytanic.cloudnet.lib.server.ServerConfig)4 ServerInfo (de.dytanic.cloudnet.lib.server.info.ServerInfo)4 HttpURLConnection (java.net.HttpURLConnection)4 URL (java.net.URL)4 ConnectableAddress (de.dytanic.cloudnet.lib.ConnectableAddress)3 CloudPlayer (de.dytanic.cloudnet.lib.player.CloudPlayer)3 Template (de.dytanic.cloudnet.lib.server.template.Template)3 ServerInstallablePlugin (de.dytanic.cloudnet.lib.service.plugin.ServerInstallablePlugin)3 SimpledUser (de.dytanic.cloudnet.lib.user.SimpledUser)3 Acceptable (de.dytanic.cloudnet.lib.utility.Acceptable)3 MinecraftServer (de.dytanic.cloudnetcore.network.components.MinecraftServer)3 IOException (java.io.IOException)3