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);
}
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;
}
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;
}
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;
}
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);
}
Aggregations