Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add config option for new username join messages #4290

Merged
merged 7 commits into from
Jul 7, 2021

Conversation

Chew
Copy link
Member

@Chew Chew commented Jun 30, 2021

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
Copy link
Member

@JRoy JRoy left a comment

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
Copy link
Member Author

Chew commented Jul 1, 2021

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
Copy link
Member

JRoy commented Jul 1, 2021

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()

@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.
# for free to join this conversation on GitHub. Already have an account? # 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