Search in sources :

Example 6 with PermissionEntity

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

Example 7 with PermissionEntity

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

the class VaultPermissionImpl method groupHas.

@Override
public boolean groupHas(String s, String s1, String s2) {
    OfflinePlayer offlinePlayer = getPlayer(s1);
    PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
    return permissionEntity.isInGroup(s2);
}
Also used : OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) PermissionEntity(de.dytanic.cloudnet.lib.player.permission.PermissionEntity)

Example 8 with PermissionEntity

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

the class VaultPermissionImpl method playerInGroup.

@Override
public boolean playerInGroup(String s, String s1, String s2) {
    OfflinePlayer offlinePlayer = getPlayer(s1);
    PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
    return permissionEntity.isInGroup(s2);
}
Also used : OfflinePlayer(de.dytanic.cloudnet.lib.player.OfflinePlayer) PermissionEntity(de.dytanic.cloudnet.lib.player.permission.PermissionEntity)

Aggregations

PermissionEntity (de.dytanic.cloudnet.lib.player.permission.PermissionEntity)8 OfflinePlayer (de.dytanic.cloudnet.lib.player.OfflinePlayer)7 GroupEntityData (de.dytanic.cloudnet.lib.player.permission.GroupEntityData)4 CloudPlayer (de.dytanic.cloudnet.lib.player.CloudPlayer)1 PlayerConnection (de.dytanic.cloudnet.lib.player.PlayerConnection)1 PlayerExecutor (de.dytanic.cloudnet.lib.player.PlayerExecutor)1