Search in sources :

Example 16 with OfflinePlayer

use of de.dytanic.cloudnet.lib.player.OfflinePlayer 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 17 with OfflinePlayer

use of de.dytanic.cloudnet.lib.player.OfflinePlayer 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 18 with OfflinePlayer

use of de.dytanic.cloudnet.lib.player.OfflinePlayer 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)

Aggregations

OfflinePlayer (de.dytanic.cloudnet.lib.player.OfflinePlayer)18 PermissionEntity (de.dytanic.cloudnet.lib.player.permission.PermissionEntity)7 Document (de.dytanic.cloudnet.lib.utility.document.Document)5 DatabaseDocument (de.dytanic.cloudnet.lib.database.DatabaseDocument)4 GroupEntityData (de.dytanic.cloudnet.lib.player.permission.GroupEntityData)4 CloudPlayer (de.dytanic.cloudnet.lib.player.CloudPlayer)3 UUID (java.util.UUID)3 PacketOutUpdateOfflinePlayer (de.dytanic.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer)2 SimpleDateFormat (java.text.SimpleDateFormat)2 TypeToken (com.google.gson.reflect.TypeToken)1 PlayerConnection (de.dytanic.cloudnet.lib.player.PlayerConnection)1 PlayerExecutor (de.dytanic.cloudnet.lib.player.PlayerExecutor)1 DefaultPermissionGroup (de.dytanic.cloudnet.lib.player.permission.DefaultPermissionGroup)1 PermissionGroup (de.dytanic.cloudnet.lib.player.permission.PermissionGroup)1 PermissionPool (de.dytanic.cloudnet.lib.player.permission.PermissionPool)1 PlayerDatabase (de.dytanic.cloudnetcore.database.PlayerDatabase)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1