镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add config option for new username join messages - #4290

Merged
JRoy merged 7 commits into
EssentialsX:2.xfrom
Chew:feat/2716
Jul 7, 2021
Merged

JRoy merged 7 commits into
EssentialsX:2.xfrom
Chew:feat/2716

Conversation

@Chew

@Chew Chew commented Jun 30, 2021 •

Copy link
Copy Markdown
Member

Information

This PR closes #2716.

Details

Proposed feature:

As proposed in the aforementioned issue, this PR implements support for prior username checking.

This only shows when the stored last username differs from what the user joined with. I.e., it will only show when they join for the first time after a name change assuming they have joined before.

This feature isn't enabled by default and must be configured to work properly.

Environments tested:

Tested via ./gradlew EssentialsX:runServer

OS: Mac OS X 10.16 (x86_64) aka macOS Big Sur

Java version: Java 15 (OpenJDK 64-Bit Server VM 15.0.1+9-18)

  • Most recent Paper version (1.16.5, git-Paper-779)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

(Assuming new username each time)

Modified custom-join-message:

image

Final thoughts

We never appear to have modified the join message ever, so doing it feels a bit weird. Worst case we only change it for custom join messages. Does this feel like the best way to handle it?

@Chew Chew added module: main Issues or PRs for the main Essentials module type: enhancement Features and feature requests. labels Jun 30, 2021

@JRoy JRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom-new-username-message should rely on custom-join-message being set as well. Otherwise we end up with weird behavior when we don't have a custom join message and we find out in delayedJoin that the user doesn't have a name change.

@Chew

Chew commented Jul 1, 2021

Copy link
Copy Markdown
Member Author

So don't modify the initial string at all, I guess? If they want to change it have them set the join message to "{USERNAME}{OLDUSERNAME} joined the game"?

@JRoy

JRoy commented Jul 1, 2021

Copy link
Copy Markdown
Member

So don't modify the initial string at all, I guess? If they want to change it have them set the join message to "{USERNAME}{OLDUSERNAME} joined the game"?

No no, keep the separate messages, but only do event.setJoinMessage(null); if ess.getSettings().isCustomNewUsernameMessage() is true as well as ess.getSettings().isCustomJoinMessage()

Comment thread Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java Outdated
Comment thread Essentials/src/main/resources/config.yml Outdated
Comment thread Essentials/src/main/resources/config.yml Outdated
Comment thread Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java Outdated
Comment thread Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java Outdated
@JRoy JRoy changed the title Add support for showing prior usernames Add config option for new username join messages Jul 7, 2021
@JRoy
JRoy enabled auto-merge (squash) July 7, 2021 15:45
@JRoy JRoy added this to the 2.19.0 milestone Jul 7, 2021
@JRoy
JRoy merged commit ff58d8e into EssentialsX:2.x Jul 7, 2021
@Chew
Chew deleted the feat/2716 branch July 7, 2021 16:12
mdcfe pushed a commit that referenced this pull request Jul 9, 2021
This fixes a bug in #4290 in which custom join messages would throw a NullPointerException if the user hasn't changed their username.
ressidell pushed a commit to ressidell/Essentials that referenced this pull request Apr 27, 2025
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
ressidell pushed a commit to ressidell/Essentials that referenced this pull request Apr 27, 2025
This fixes a bug in EssentialsX#4290 in which custom join messages would throw a NullPointerException if the user hasn't changed their username.
rewsdjad1 pushed a commit to rewsdjad1/EssentialsXPlus that referenced this pull request Aug 13, 2026
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
rewsdjad1 pushed a commit to rewsdjad1/EssentialsXPlus that referenced this pull request Aug 13, 2026
This fixes a bug in EssentialsX#4290 in which custom join messages would throw a NullPointerException if the user hasn't changed their username.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: main Issues or PRs for the main Essentials module type: enhancement Features and feature requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Option to display old username in custom join messages

2 participants