use of org.terasology.engine.logic.permission.PermissionManager in project Terasology by MovingBlocks.
the class ConsoleImpl method clientHasPermission.
private boolean clientHasPermission(EntityRef callingClient, String requiredPermission) {
Preconditions.checkNotNull(callingClient, "The calling client must not be null!");
PermissionManager permissionManager = context.get(PermissionManager.class);
boolean hasPermission = true;
if (permissionManager != null && requiredPermission != null && !requiredPermission.equals(PermissionManager.NO_PERMISSION)) {
hasPermission = false;
ClientComponent clientComponent = callingClient.getComponent(ClientComponent.class);
if (permissionManager.hasPermission(clientComponent.clientInfo, requiredPermission)) {
hasPermission = true;
}
}
return hasPermission;
}
Aggregations