fix: reset nickname when player changes Minecraft account name#6470
fix: reset nickname when player changes Minecraft account name#6470hudsonandres wants to merge 3 commits intoEssentialsX:2.xfrom
Conversation
- When a premium player changes their Minecraft username, any previously set nickname (including RGB-formatted ones) is now automatically cleared on their next login, equivalent to running /nick off.
|
How it works: Every time a player joins, the code already compares If they differ, meaning the player changed their Minecraft username - and the player has a nickname set, The subsequent |
|
I think this behavior needs to be configurable |
JRoy
left a comment
There was a problem hiding this comment.
please add a configuration option for this defaulting off.
The nickname reset functionality is now disabled by default (false). Administrators can enable it by setting 'reset-nick-on-name-change: true' in config.yml.
The requested option has been added. |
| if (lastAccountName != null && !lastAccountName.equals(user.getBase().getName()) && user.getNickname() != null) { | ||
| user.setNickname(null); | ||
| } |
There was a problem hiding this comment.
Need to check if the config option is enabled.
There was a problem hiding this comment.
Sorry for the lack of attention, thank you for the feedback!
Information
This PR fixes #6469.
Details
Proposed fix:
When a premium player changes their Minecraft username, any previously set nickname (including RGB-formatted ones) is now automatically cleared on their next login, equivalent to running /nick off.
Environments tested:
OS: Linux
Java version: OpenJDK 21.0.7
Bukkit Version - Purpur 1.21.11-R0.1-SNAPSHOT
Demonstration:
Before: No log to show
After: No log to show