Class PermissionUtil

java.lang.Object
com.mewna.catnip.util.PermissionUtil

public final class PermissionUtil extends Object
  • Method Details

    • effectivePermissions

      public static long effectivePermissions(@Nonnull Permissable member)
    • effectivePermissions

      public static long effectivePermissions(@Nonnull Permissable member, @Nonnull GuildChannel channel)
    • 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

      public static void checkHierarchy(@Nonnull Member target, @Nonnull Guild guild)
    • checkHierarchy

      public static void checkHierarchy(@Nonnull Role target, @Nonnull Guild guild)
    • canInteract

      public static boolean canInteract(@Nonnull Member actor, @Nonnull Member target)
      Checks whether a member has the permission to interact with another member
      Parameters:
      actor - The member that want to perform the action
      target - 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

      public static boolean canInteract(@Nonnull Role actor, @Nonnull Member target)
      Checks whether a role has the permission to interact with a member
      Parameters:
      actor - The role that want to perform the action
      target - 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

      public static boolean canInteract(@Nonnull Member actor, @Nonnull Role target)
      Checks whether a member has the permission to interact with a role
      Parameters:
      actor - The member that want to perform the action
      target - 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

      public static boolean canInteract(@Nonnull Role actor, @Nonnull Role target)
      Checks whether a role has the permission to interact with another role
      Parameters:
      actor - The role that want to perform the action
      target - 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