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