Package net.dv8tion.jda.api.entities
Enum User.UserFlag
- java.lang.Object
-
- java.lang.Enum<User.UserFlag>
-
- net.dv8tion.jda.api.entities.User.UserFlag
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<User.UserFlag>
- Enclosing interface:
- User
public static enum User.UserFlag extends java.lang.Enum<User.UserFlag>
Represents the bit offsets used by Discord for public flags
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOT_HTTP_INTERACTIONS
Bot uses only HTTP interactions and is shown in the online member listBUG_HUNTER_LEVEL_1
BUG_HUNTER_LEVEL_2
CERTIFIED_MODERATOR
EARLY_SUPPORTER
HYPESQUAD
HYPESQUAD_BALANCE
HYPESQUAD_BRAVERY
HYPESQUAD_BRILLIANCE
PARTNER
STAFF
SYSTEM
Deprecated.TEAM_USER
User is ateam
UNKNOWN
VERIFIED_BOT
VERIFIED_DEVELOPER
-
Field Summary
Fields Modifier and Type Field Description static User.UserFlag[]
EMPTY_FLAGS
Empty array of UserFlag enum, useful for optimized use inCollection.toArray(Object[])
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.EnumSet<User.UserFlag>
getFlags(int flags)
A set of all UserFlags that are specified by this raw int representation of flags.static User.UserFlag
getFromOffset(int offset)
Gets the first UserFlag relating to the provided offset.java.lang.String
getName()
The readable name as used in the Discord Client.int
getOffset()
The binary offset of the flag.static int
getRaw(java.util.Collection<User.UserFlag> flags)
This is effectively the opposite ofgetFlags(int)
.static int
getRaw(User.UserFlag... flags)
This is effectively the opposite ofgetFlags(int)
, this takes 1 or more UserFlags and returns the bitmask representation of the flags.int
getRawValue()
The value of this flag when viewed as raw value.static User.UserFlag
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static User.UserFlag[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
STAFF
public static final User.UserFlag STAFF
-
PARTNER
public static final User.UserFlag PARTNER
-
HYPESQUAD
public static final User.UserFlag HYPESQUAD
-
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
-
TEAM_USER
public static final User.UserFlag TEAM_USER
User is ateam
-
SYSTEM
@Deprecated @ForRemoval(deadline="4.4.0") @ReplaceWith("User.isSystem()") @DeprecatedSince("4.3.0") public static final User.UserFlag SYSTEM
Deprecated.
-
BUG_HUNTER_LEVEL_2
public static final User.UserFlag BUG_HUNTER_LEVEL_2
-
VERIFIED_BOT
public static final User.UserFlag VERIFIED_BOT
-
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
-
UNKNOWN
public static final User.UserFlag UNKNOWN
-
-
Field Detail
-
EMPTY_FLAGS
public static final User.UserFlag[] EMPTY_FLAGS
Empty array of UserFlag enum, useful for optimized use inCollection.toArray(Object[])
.
-
-
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(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getName
@Nonnull public java.lang.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 java.util.EnumSet<User.UserFlag> getFlags(int flags)
A set of all UserFlags that are specified by this raw int representation of flags.- Parameters:
flags
- The rawint
representation if flags.- Returns:
- Possibly-empty EnumSet of UserFlags.
-
getRaw
public static int getRaw(@Nonnull User.UserFlag... flags)
This is effectively the opposite ofgetFlags(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:
java.lang.IllegalArgumentException
- When the provided UserFlags are null.
-
getRaw
public static int getRaw(@Nonnull java.util.Collection<User.UserFlag> flags)
This is effectively the opposite ofgetFlags(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:
java.lang.IllegalArgumentException
- When the provided UserFLags are null.- See Also:
EnumSet
-
-