Package com.mewna.catnip.util
Class PermissionUtil
java.lang.Object
com.mewna.catnip.util.PermissionUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canInteract
(Member actor, Member target) Checks whether a member has the permission to interact with another memberstatic boolean
canInteract
(Member actor, Role target) Checks whether a member has the permission to interact with a rolestatic boolean
canInteract
(Role actor, Member target) Checks whether a role has the permission to interact with a memberstatic boolean
canInteract
(Role actor, Role target) Checks whether a role has the permission to interact with another rolestatic void
checkHierarchy
(Member target, Guild guild) static void
checkHierarchy
(Role target, Guild guild) static void
checkPermissions
(Catnip catnip, String guildId, Permission... permissions) static void
checkPermissions
(Catnip catnip, String guildId, String channelId, Permission... permissions) static long
effectivePermissions
(Permissable member) static long
effectivePermissions
(Permissable member, GuildChannel channel)
-
Method Details
-
effectivePermissions
-
effectivePermissions
-
checkPermissions
public static void checkPermissions(@Nonnull Catnip catnip, @Nullable String guildId, @Nonnull Permission... permissions) -
checkPermissions
public static void checkPermissions(@Nonnull Catnip catnip, @Nullable String guildId, @Nullable String channelId, @Nonnull Permission... permissions) -
checkHierarchy
-
checkHierarchy
-
canInteract
Checks whether a member has the permission to interact with another member- Parameters:
actor
- The member that want to perform the actiontarget
- The member that the action is performed on- Returns:
- Whether the actor can interact with the target or not
- Throws:
IllegalStateException
- If the actor is not on the same guild as the target
-
canInteract
Checks whether a role has the permission to interact with a member- Parameters:
actor
- The role that want to perform the actiontarget
- The member that the action is performed on- Returns:
- Whether the actor can interact with the target or not
- Throws:
IllegalStateException
- If the actor is not on the same guild as the target
-
canInteract
Checks whether a member has the permission to interact with a role- Parameters:
actor
- The member that want to perform the actiontarget
- The role that the action is performed on- Returns:
- Whether the actor can interact with the target or not
- Throws:
IllegalStateException
- If the actor is not on the same guild as the target
-
canInteract
Checks whether a role has the permission to interact with another role- Parameters:
actor
- The role that want to perform the actiontarget
- The role that the action is performed on- Returns:
- Whether the actor can interact with the target or not
- Throws:
IllegalStateException
- If the actor is not on the same guild as the target
-