Interface RoleManager
-
- All Superinterfaces:
AuditableRestAction<java.lang.Void>,Manager<RoleManager>,RestAction<java.lang.Void>
public interface RoleManager extends Manager<RoleManager>
Manager providing functionality to update one or more fields for aRole.Example
manager.setName("Administrator") .setColor(null) .queue(); manager.reset(RoleManager.PERMISSION | RoleManager.NAME) .setName("Traitor") .setColor(Color.RED) .queue();- See Also:
Role.getManager()
-
-
Field Summary
Fields Modifier and Type Field Description static longCOLORUsed to reset the color fieldstatic longHOISTUsed to reset the hoisted fieldstatic longICONUsed to reset the icon fieldstatic longMENTIONABLEUsed to reset the mentionable fieldstatic longNAMEUsed to reset the name fieldstatic longPERMISSIONUsed to reset the permission field
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default GuildgetGuild()RolegetRole()The targetRolefor this managerRoleManagergivePermissions(java.util.Collection<Permission> perms)Adds the specifiedPermissionsto the selectedRole.default RoleManagergivePermissions(Permission... perms)Adds the specifiedPermissionsto the selectedRole.RoleManagerreset(long fields)Resets the fields specified by the provided bit-flag pattern.RoleManagerreset(long... fields)Resets the fields specified by the provided bit-flag patterns.RoleManagerrevokePermissions(java.util.Collection<Permission> perms)Revokes the specifiedPermissionsfrom the selectedRole.default RoleManagerrevokePermissions(Permission... perms)Revokes the specifiedPermissionsfrom the selectedRole.RoleManagersetColor(int rgb)Sets the rgb color of the selectedRole.default RoleManagersetColor(java.awt.Color color)Sets theColorof the selectedRole.RoleManagersetHoisted(boolean hoisted)Sets the hoist state of the selectedRole.RoleManagersetIcon(java.lang.String emoji)Sets the Unicode Emoji of thisRoleinstead of a custom image.RoleManagersetIcon(Icon icon)RoleManagersetMentionable(boolean mentionable)Sets the mentionable state of the selectedRole.RoleManagersetName(java.lang.String name)Sets the name of the selectedRole.RoleManagersetPermissions(long perms)Sets thePermissionsof the selectedRole.default RoleManagersetPermissions(java.util.Collection<Permission> permissions)Sets thePermissionsof the selectedRole.default RoleManagersetPermissions(Permission... permissions)Sets thePermissionsof the selectedRole.-
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
-
Methods inherited from interface net.dv8tion.jda.api.managers.Manager
deadline, reset, setCheck, timeout
-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
-
-
-
Field Detail
-
NAME
static final long NAME
Used to reset the name field- See Also:
- Constant Field Values
-
COLOR
static final long COLOR
Used to reset the color field- See Also:
- Constant Field Values
-
PERMISSION
static final long PERMISSION
Used to reset the permission field- See Also:
- Constant Field Values
-
HOIST
static final long HOIST
Used to reset the hoisted field- See Also:
- Constant Field Values
-
MENTIONABLE
static final long MENTIONABLE
Used to reset the mentionable field- See Also:
- Constant Field Values
-
ICON
static final long ICON
Used to reset the icon field- See Also:
- Constant Field Values
-
-
Method Detail
-
reset
@Nonnull RoleManager reset(long fields)
Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(RoleManager.COLOR | RoleManager.NAME);Flag Constants:
- Specified by:
resetin interfaceManager<RoleManager>- Parameters:
fields- Integer value containing the flags to reset.- Returns:
- RoleManager for chaining convenience
-
reset
@Nonnull RoleManager reset(long... fields)
Resets the fields specified by the provided bit-flag patterns. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(RoleManager.COLOR, RoleManager.NAME);Flag Constants:
- Specified by:
resetin interfaceManager<RoleManager>- Parameters:
fields- Integer values containing the flags to reset.- Returns:
- RoleManager for chaining convenience
-
setName
@Nonnull @CheckReturnValue RoleManager setName(@Nonnull java.lang.String name)
Sets the name of the selectedRole.A role name must not be
nullnor less than 1 characters or more than 32 characters long!- Parameters:
name- The new name for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
java.lang.IllegalArgumentException- If the provided name isnullor not between 1-100 characters long
-
setPermissions
@Nonnull @CheckReturnValue RoleManager setPermissions(long perms)
Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The new raw permission value for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
setPermissions(Collection),setPermissions(Permission...)
-
setPermissions
@Nonnull @CheckReturnValue default RoleManager setPermissions(@Nonnull Permission... permissions)
Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
permissions- The new permission for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissionsjava.lang.IllegalArgumentException- If any of the provided values isnull- See Also:
setPermissions(Collection),setPermissions(long),Permission.getRaw(Permission...)
-
setPermissions
@Nonnull @CheckReturnValue default RoleManager setPermissions(@Nonnull java.util.Collection<Permission> permissions)
Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
permissions- The new permission for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissionsjava.lang.IllegalArgumentException- If any of the provided values isnull- See Also:
setPermissions(Permission...),setPermissions(long),EnumSet,Permission.getRaw(Collection)
-
setColor
@Nonnull @CheckReturnValue default RoleManager setColor(@Nullable java.awt.Color color)
Sets theColorof the selectedRole.- Parameters:
color- The new color for the selectedRole- Returns:
- RoleManager for chaining convenience
-
setColor
@Nonnull @CheckReturnValue RoleManager setColor(int rgb)
Sets the rgb color of the selectedRole.- Parameters:
rgb- The new color for the selectedRole- Returns:
- RoleManager for chaining convenience
- See Also:
Role.DEFAULT_COLOR_RAW
-
setHoisted
@Nonnull @CheckReturnValue RoleManager setHoisted(boolean hoisted)
Sets the hoist state of the selectedRole.- Parameters:
hoisted- Whether the selectedRoleshould be hoisted- Returns:
- RoleManager for chaining convenience
-
setMentionable
@Nonnull @CheckReturnValue RoleManager setMentionable(boolean mentionable)
Sets the mentionable state of the selectedRole.- Parameters:
mentionable- Whether the selectedRoleshould be mentionable- Returns:
- RoleManager for chaining convenience
-
setIcon
@Nonnull @CheckReturnValue RoleManager setIcon(@Nullable Icon icon)
- Parameters:
icon- The new icon for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
-
setIcon
@Nonnull @CheckReturnValue RoleManager setIcon(@Nullable java.lang.String emoji)
Sets the Unicode Emoji of thisRoleinstead of a custom image.- Parameters:
emoji- The new Unicode Emoji for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
-
givePermissions
@Nonnull @CheckReturnValue default RoleManager givePermissions(@Nonnull Permission... perms)
Adds the specifiedPermissionsto the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
setPermissions(Collection),setPermissions(Permission...),Permission.getRaw(Permission...)
-
givePermissions
@Nonnull @CheckReturnValue RoleManager givePermissions(@Nonnull java.util.Collection<Permission> perms)
Adds the specifiedPermissionsto the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
setPermissions(Collection),setPermissions(Permission...),EnumSet,Permission.getRaw(Collection)
-
revokePermissions
@Nonnull @CheckReturnValue default RoleManager revokePermissions(@Nonnull Permission... perms)
Revokes the specifiedPermissionsfrom the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to revoke permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to revoke one of the specified permissions- See Also:
setPermissions(Collection),setPermissions(Permission...),Permission.getRaw(Permission...)
-
revokePermissions
@Nonnull @CheckReturnValue RoleManager revokePermissions(@Nonnull java.util.Collection<Permission> perms)
Revokes the specifiedPermissionsfrom the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to revoke permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to revoke one of the specified permissions- See Also:
setPermissions(Collection),setPermissions(Permission...),EnumSet,Permission.getRaw(Collection)
-
-