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 long
COLOR
Used to reset the color fieldstatic long
HOIST
Used to reset the hoisted fieldstatic long
ICON
Used to reset the icon fieldstatic long
MENTIONABLE
Used to reset the mentionable fieldstatic long
NAME
Used to reset the name fieldstatic long
PERMISSION
Used to reset the permission field
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Guild
getGuild()
Role
getRole()
The targetRole
for this managerRoleManager
givePermissions(java.util.Collection<Permission> perms)
Adds the specifiedPermissions
to the selectedRole
.default RoleManager
givePermissions(Permission... perms)
Adds the specifiedPermissions
to the selectedRole
.RoleManager
reset(long fields)
Resets the fields specified by the provided bit-flag pattern.RoleManager
reset(long... fields)
Resets the fields specified by the provided bit-flag patterns.RoleManager
revokePermissions(java.util.Collection<Permission> perms)
Revokes the specifiedPermissions
from the selectedRole
.default RoleManager
revokePermissions(Permission... perms)
Revokes the specifiedPermissions
from the selectedRole
.RoleManager
setColor(int rgb)
Sets the rgb color of the selectedRole
.default RoleManager
setColor(java.awt.Color color)
Sets theColor
of the selectedRole
.RoleManager
setHoisted(boolean hoisted)
Sets the hoist state of the selectedRole
.RoleManager
setIcon(java.lang.String emoji)
Sets the Unicode Emoji of thisRole
instead of a custom image.RoleManager
setIcon(Icon icon)
RoleManager
setMentionable(boolean mentionable)
Sets the mentionable state of the selectedRole
.RoleManager
setName(java.lang.String name)
Sets the name of the selectedRole
.RoleManager
setPermissions(long perms)
Sets thePermissions
of the selectedRole
.default RoleManager
setPermissions(java.util.Collection<Permission> permissions)
Sets thePermissions
of the selectedRole
.default RoleManager
setPermissions(Permission... permissions)
Sets thePermissions
of 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:
reset
in 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:
reset
in 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
null
nor 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 isnull
or not between 1-100 characters long
-
setPermissions
@Nonnull @CheckReturnValue RoleManager setPermissions(long perms)
Sets thePermissions
of 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 thePermissions
of 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 thePermissions
of 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 theColor
of 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 selectedRole
should 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 selectedRole
should be mentionable- Returns:
- RoleManager for chaining convenience
-
setIcon
@Nonnull @CheckReturnValue RoleManager setIcon(@Nullable Icon icon)
- Parameters:
icon
- The new icon for thisRole
ornull
to reset- Returns:
- RoleManager for chaining convenience
-
setIcon
@Nonnull @CheckReturnValue RoleManager setIcon(@Nullable java.lang.String emoji)
Sets the Unicode Emoji of thisRole
instead of a custom image.- Parameters:
emoji
- The new Unicode Emoji for thisRole
ornull
to reset- Returns:
- RoleManager for chaining convenience
-
givePermissions
@Nonnull @CheckReturnValue default RoleManager givePermissions(@Nonnull Permission... perms)
Adds the specifiedPermissions
to 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 specifiedPermissions
to 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 specifiedPermissions
from 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 specifiedPermissions
from 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)
-
-