Skip to content

fix(command): handle accounts without an email in /authme email - #3162

Merged
Xephi merged 1 commit into
AuthMe:masterfrom
rishabhvenu:fix/getemail-no-email
Oct 11, 2026
Merged

Xephi merged 1 commit into
AuthMe:masterfrom
rishabhvenu:fix/getemail-no-email

Conversation

@rishabhvenu

Copy link
Copy Markdown
Contributor

/authme email <player> throws when the account exists but has no email, as in the stack trace in #3091. GetEmailCommand passes email.getValue() straight to the admin.email_show message; the value is null for such an account and Messages.retrieveSingle fails in String.replace with "replacement" is null. The sender only gets "An unexpected error occurred trying to execute that command".

The command now checks the value with Utils.isEmailEmpty, the same check /email show uses, and sends the existing email.no_email_for_account message. I reused that message to avoid a new key in every language file. Its wording is addressed to the player ("You currently don't have email address associated with this account."), so tell me if you would rather have a separate admin message and I will add one.

Testing:

  • Added GetEmailCommandTest.shouldReportMissingEmail; it fails on master and passes with the change.
  • mvn -V -B clean package on JDK 21 (all modules) and JDK 17: build passes, 1445 tests in authme-core. PurgeServiceTest.shouldRunAutoPurge failed once on a loaded machine (124 ms against its 100 ms tolerance) and passed on the rerun; it is unrelated.
  • Paper 1.21.11, SQLite, AuthMe-*-Paper.jar: on master authme email <name> from the console logs the NPE from the issue for an account without an email; with the change it prints the message. Same result for an op player running /authme email in game. An account with an email still prints <name>'s email: ..., and an unknown name still prints "This user isn't registered!".

Not tested: MySQL and PostgreSQL.

Fixes #3091

GetEmailCommand passed the stored email straight to the admin.email_show
message. For an account that has no email the value is null, so
Messages.retrieveSingle threw a NullPointerException and the sender only
got "An unexpected error occurred".

Check the value with Utils.isEmailEmpty, as /email show does, and send
the existing email.no_email_for_account message in that case.

Fixes AuthMe#3091
@Xephi
Xephi merged commit 4ceac21 into AuthMe:master Oct 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

'email show' command didn’t take into account the case where players haven’t linked an email.

2 participants