Class UserUpdateNameEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.user.GenericUserEvent
-
- net.dv8tion.jda.api.events.user.update.GenericUserUpdateEvent<java.lang.String>
-
- net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent
-
- All Implemented Interfaces:
GenericEvent
,UpdateEvent<User,java.lang.String>
public class UserUpdateNameEvent extends GenericUserUpdateEvent<java.lang.String>
Indicates that the username of aUser
changed. (Not Nickname)Can be used to retrieve the User who changed their username and their previous username.
Identifier:
name
Requirements
This event requires the
GUILD_MEMBERS
intent to be enabled.createDefault(String)
andcreateLight(String)
disable this by default!Additionally, this event requires the
MemberCachePolicy
to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the member was updated and gives us the updated member object. In order to fire a specific event like this we need to have the old member cached to compare against.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IDENTIFIER
-
Constructor Summary
Constructors Constructor Description UserUpdateNameEvent(JDA api, long responseNumber, User user, java.lang.String oldName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getNewName()
The new usernamejava.lang.String
getNewValue()
The new valuejava.lang.String
getOldName()
The old usernamejava.lang.String
getOldValue()
The old value-
Methods inherited from class net.dv8tion.jda.api.events.user.update.GenericUserUpdateEvent
getEntity, getPropertyIdentifier, toString
-
Methods inherited from class net.dv8tion.jda.api.events.user.GenericUserEvent
getUser
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.dv8tion.jda.api.events.GenericEvent
getJDA, getResponseNumber
-
Methods inherited from interface net.dv8tion.jda.api.events.UpdateEvent
getEntityType
-
-
-
-
Field Detail
-
IDENTIFIER
public static final java.lang.String IDENTIFIER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOldName
@Nonnull public java.lang.String getOldName()
The old username- Returns:
- The old username
-
getNewName
@Nonnull public java.lang.String getNewName()
The new username- Returns:
- The new username
-
getOldValue
@Nonnull public java.lang.String getOldValue()
Description copied from interface:UpdateEvent
The old value- Specified by:
getOldValue
in interfaceUpdateEvent<User,java.lang.String>
- Overrides:
getOldValue
in classGenericUserUpdateEvent<java.lang.String>
- Returns:
- The old value
-
getNewValue
@Nonnull public java.lang.String getNewValue()
Description copied from interface:UpdateEvent
The new value- Specified by:
getNewValue
in interfaceUpdateEvent<User,java.lang.String>
- Overrides:
getNewValue
in classGenericUserUpdateEvent<java.lang.String>
- Returns:
- The new value
-
-