Search in sources :

Example 6 with GroupEntityData

use of de.dytanic.cloudnet.lib.player.permission.GroupEntityData in project CloudNet by Dytanic.

the class VaultPermissionImpl method playerAddGroup.

@Override
public boolean playerAddGroup(String s, String s1, String s2) {
    OfflinePlayer offlinePlayer = getPlayer(s1);
    PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
    GroupEntityData groupEntityData = CollectionWrapper.filter(permissionEntity.getGroups(), new Acceptable<GroupEntityData>() {

        @Override
        public boolean isAccepted(GroupEntityData groupEntityData) {
            return groupEntityData.getGroup().equalsIgnoreCase(s2);
        }
    });
    if (groupEntityData != null) {
        permissionEntity.getGroups().remove(groupEntityData);
        groupEntityData = new GroupEntityData(groupEntityData.getGroup(), 0);
    } else {
        groupEntityData = new GroupEntityData(groupEntityData.getGroup(), 0);
    }
    permissionEntity.getGroups().add(groupEntityData);
    offlinePlayer.setPermissionEntity(permissionEntity);
    updatePlayer(offlinePlayer);
    return true;
}
Also used : OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) PermissionEntity(de.dytanic.cloudnet.lib.player.permission.PermissionEntity) GroupEntityData(de.dytanic.cloudnet.lib.player.permission.GroupEntityData)

Aggregations

GroupEntityData (de.dytanic.cloudnet.lib.player.permission.GroupEntityData)6 OfflinePlayer (de.dytanic.cloudnet.lib.player.OfflinePlayer)4 PermissionEntity (de.dytanic.cloudnet.lib.player.permission.PermissionEntity)4 CloudPlayer (de.dytanic.cloudnet.lib.player.CloudPlayer)2 CloudPermissble (de.dytanic.cloudnet.bridge.internal.util.CloudPermissble)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 PacketOutUpdateOfflinePlayer (de.dytanic.cloudnetcore.network.packet.out.PacketOutUpdateOfflinePlayer)1 Field (java.lang.reflect.Field)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 UUID (java.util.UUID)1 EventHandler (org.bukkit.event.EventHandler)1