Enum User.UserFlag

    • Enum Constant Detail

      • BUG_HUNTER_LEVEL_1

        public static final User.UserFlag BUG_HUNTER_LEVEL_1
      • HYPESQUAD_BRAVERY

        public static final User.UserFlag HYPESQUAD_BRAVERY
      • HYPESQUAD_BRILLIANCE

        public static final User.UserFlag HYPESQUAD_BRILLIANCE
      • HYPESQUAD_BALANCE

        public static final User.UserFlag HYPESQUAD_BALANCE
      • EARLY_SUPPORTER

        public static final User.UserFlag EARLY_SUPPORTER
      • BUG_HUNTER_LEVEL_2

        public static final User.UserFlag BUG_HUNTER_LEVEL_2
      • VERIFIED_DEVELOPER

        public static final User.UserFlag VERIFIED_DEVELOPER
      • CERTIFIED_MODERATOR

        public static final User.UserFlag CERTIFIED_MODERATOR
      • BOT_HTTP_INTERACTIONS

        public static final User.UserFlag BOT_HTTP_INTERACTIONS
        Bot uses only HTTP interactions and is shown in the online member list
    • Method Detail

      • values

        public static User.UserFlag[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (User.UserFlag c : User.UserFlag.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static User.UserFlag valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getName

        @Nonnull
        public String getName()
        The readable name as used in the Discord Client.
        Returns:
        The readable name of this UserFlag.
      • getOffset

        public int getOffset()
        The binary offset of the flag.
        Returns:
        The offset that represents this UserFlag.
      • getRawValue

        public int getRawValue()
        The value of this flag when viewed as raw value.
        This is equivalent to: 1 << getOffset()
        Returns:
        The raw value of this specific flag.
      • getFromOffset

        @Nonnull
        public static User.UserFlag getFromOffset​(int offset)
        Gets the first UserFlag relating to the provided offset.
        If there is no UserFlag that matches the provided offset, UNKNOWN is returned.
        Parameters:
        offset - The offset to match a UserFlag to.
        Returns:
        UserFlag relating to the provided offset.
      • getFlags

        @Nonnull
        public static EnumSet<User.UserFlag> getFlags​(int flags)
        A set of all UserFlags that are specified by this raw int representation of flags.
        Parameters:
        flags - The raw int representation if flags.
        Returns:
        Possibly-empty EnumSet of UserFlags.
      • getRaw

        public static int getRaw​(@Nonnull
                                 User.UserFlag... flags)
        This is effectively the opposite of getFlags(int), this takes 1 or more UserFlags and returns the bitmask representation of the flags.
        Parameters:
        flags - The array of flags of which to form into the raw int representation.
        Returns:
        bitmask representing the provided flags.
        Throws:
        IllegalArgumentException - When the provided UserFlags are null.
      • getRaw

        public static int getRaw​(@Nonnull
                                 Collection<User.UserFlag> flags)
        This is effectively the opposite of getFlags(int). This takes a collection of UserFlags and returns the bitmask representation of the flags.
        Example: getRaw(EnumSet.of(UserFlag.STAFF, UserFlag.HYPESQUAD))
        Parameters:
        flags - The flags to convert
        Returns:
        bitmask representing the provided flags.
        Throws:
        IllegalArgumentException - When the provided UserFLags are null.
        See Also:
        EnumSet