Search in sources :

Example 46 with Document

use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.

the class NameToUUIDDatabase method replace.

public void replace(MultiValue<UUID, String> replacer) {
    Document document = database.getDocument(replacer.getFirst().toString());
    document.append("name", replacer.getSecond());
    database.insert(document);
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 47 with Document

use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.

the class PlayerDatabase method updatePermissionEntity.

public PlayerDatabase updatePermissionEntity(UUID uuid, PermissionEntity permissionEntity) {
    Document document = database.getDocument(uuid.toString());
    OfflinePlayer offlinePlayer = document.getObject("offlinePlayer", OfflinePlayer.TYPE);
    offlinePlayer.setPermissionEntity(permissionEntity);
    database.insert(document);
    return this;
}
Also used : OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 48 with Document

use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.

the class PlayerDatabase method registerPlayer.

public OfflinePlayer registerPlayer(PlayerConnection playerConnection) {
    OfflinePlayer offlinePlayer = new OfflinePlayer(playerConnection.getUniqueId(), playerConnection.getName(), new Document(), System.currentTimeMillis(), System.currentTimeMillis(), playerConnection, null);
    database.insert(new DatabaseDocument(playerConnection.getUniqueId().toString()).append("offlinePlayer", offlinePlayer));
    return offlinePlayer;
}
Also used : DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument) OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 49 with Document

use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.

the class PlayerDatabase method getRegisteredPlayers.

public Map<UUID, OfflinePlayer> getRegisteredPlayers() {
    database.loadDocuments();
    Map<UUID, OfflinePlayer> map = new HashMap<>();
    for (Document document : database.getDocs()) map.put(UUID.fromString(document.getString(Database.UNIQUE_NAME_KEY)), document.getObject("offlinePlayer", OfflinePlayer.TYPE));
    return map;
}
Also used : HashMap(java.util.HashMap) OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) UUID(java.util.UUID) Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

Example 50 with Document

use of de.dytanic.cloudnet.lib.utility.document.Document in project CloudNet by Dytanic.

the class StatisticManager method cloudOnlineTime.

public void cloudOnlineTime(long activeNow) {
    if (!statistic)
        return;
    Document document = database.getDocument(NAME);
    if (!document.contains("cloudOnlineTime")) {
        document.append("cloudOnlineTime", 0);
    }
    long append = System.currentTimeMillis() - activeNow;
    document.append("cloudOnlineTime", document.getLong("cloudOnlineTime") + append);
}
Also used : Document(de.dytanic.cloudnet.lib.utility.document.Document) DatabaseDocument(de.dytanic.cloudnet.lib.database.DatabaseDocument)

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