Class PermissionsBuilder
- java.lang.Object
-
- org.javacord.api.entity.permission.PermissionsBuilder
-
public class PermissionsBuilder extends java.lang.ObjectA class to createpermissionsobjects.
-
-
Constructor Summary
Constructors Constructor Description PermissionsBuilder()Creates a new permissions builder with all types set toPermissionState.UNSET.PermissionsBuilder(Permissions permissions)Creates a new permissions builder with the states of the given permissions object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Permissionsbuild()Creates aPermissionsinstance with the given values.PermissionStategetState(PermissionType type)Gets the state of the given type.PermissionsBuildersetAllAllowed()Sets all states toPermissionState.ALLOWED.PermissionsBuildersetAllDenied()Sets all states toPermissionState.DENIED.PermissionsBuildersetAllowed(PermissionType... types)Sets the state for the given types toPermissionState.ALLOWED.PermissionsBuildersetAllUnset()Sets all states toPermissionState.UNSET.PermissionsBuildersetDenied(PermissionType... types)Sets the state for the given types toPermissionState.DENIED.PermissionsBuildersetState(PermissionType type, PermissionState state)Sets the new state of the given type.PermissionsBuildersetUnset(PermissionType... types)Sets the state for the given types toPermissionState.UNSET.
-
-
-
Constructor Detail
-
PermissionsBuilder
public PermissionsBuilder()
Creates a new permissions builder with all types set toPermissionState.UNSET.
-
PermissionsBuilder
public PermissionsBuilder(Permissions permissions)
Creates a new permissions builder with the states of the given permissions object.- Parameters:
permissions- The permissions which should be copied.
-
-
Method Detail
-
setState
public PermissionsBuilder setState(PermissionType type, PermissionState state)
Sets the new state of the given type.- Parameters:
type- The type to change.state- The state to set.- Returns:
- The current instance in order to chain call methods.
-
setAllowed
public PermissionsBuilder setAllowed(PermissionType... types)
Sets the state for the given types toPermissionState.ALLOWED.- Parameters:
types- The types to change.- Returns:
- The current instance in order to chain call methods.
-
setAllAllowed
public PermissionsBuilder setAllAllowed()
Sets all states toPermissionState.ALLOWED.- Returns:
- The current instance in order to chain call methods.
-
setDenied
public PermissionsBuilder setDenied(PermissionType... types)
Sets the state for the given types toPermissionState.DENIED.- Parameters:
types- The types to change.- Returns:
- The current instance in order to chain call methods.
-
setAllDenied
public PermissionsBuilder setAllDenied()
Sets all states toPermissionState.DENIED.- Returns:
- The current instance in order to chain call methods.
-
setUnset
public PermissionsBuilder setUnset(PermissionType... types)
Sets the state for the given types toPermissionState.UNSET.- Parameters:
types- The types to change.- Returns:
- The current instance in order to chain call methods.
-
setAllUnset
public PermissionsBuilder setAllUnset()
Sets all states toPermissionState.UNSET.- Returns:
- The current instance in order to chain call methods.
-
getState
public PermissionState getState(PermissionType type)
Gets the state of the given type.- Parameters:
type- The type to check.- Returns:
- The state of the given type.
-
build
public Permissions build()
Creates aPermissionsinstance with the given values.- Returns:
- The created permissions instance.
-
-