Skip to content

Fix server-name caching and include server name in email body#15

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/server-name-caching-and-email-body
May 17, 2026
Merged

Fix server-name caching and include server name in email body#15
dmccoystephenson merged 1 commit into
mainfrom
feature/server-name-caching-and-email-body

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • Cache server-name at load time (Herald.java): server-name was being read from config on every PlayerJoinEvent. It is now read once in loadConfiguration() and stored as a serverName field, matching how Discord and email settings are handled.
  • Include server name in email body (EmailNotifier.java): The email body said "Steve has joined the server at <date>" — it never mentioned which server. It now reads "Steve has joined MySurvivalServer at <date>", consistent with the email subject.
  • Updated tests (EmailNotifierTest.java): Assertions that checked the old body format are updated to verify the server name is present.

Test plan

  • ./gradlew build -x test succeeds
  • ./gradlew clean test passes all tests
  • Email body format verified to include server name via test capture

Closes #13
Closes #14

Cache server-name in loadConfiguration() instead of re-reading on every
join event, and use the server name in the email body so both subject and
body consistently reference which server the player joined.

Closes #13
Closes #14

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses two related notification-quality issues by (1) caching the configured server name once at startup and (2) ensuring the server name is included in the email body content, aligning the body with the subject and improving clarity for multi-server setups.

Changes:

  • Cache server-name during Herald.loadConfiguration() and reuse it for join notifications.
  • Update EmailNotifier.notifyPlayerJoin() so the email body includes the serverName.
  • Update EmailNotifierTest assertions to verify the server name appears in the email body.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/java/com/dansplugins/herald/Herald.java Caches serverName at configuration load time and uses it when sending join notifications.
src/main/java/com/dansplugins/herald/EmailNotifier.java Adds serverName into the email body format for join notifications.
src/test/java/com/dansplugins/herald/EmailNotifierTest.java Updates tests to assert the new email body format includes the server name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmccoystephenson dmccoystephenson merged commit ec2e1e1 into main May 17, 2026
4 checks passed
@dmccoystephenson dmccoystephenson deleted the feature/server-name-caching-and-email-body branch May 17, 2026 09:13
dmccoystephenson added a commit that referenced this pull request May 17, 2026
* Add Unreleased section to CHANGELOG for PR #15 fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add reference link definitions to CHANGELOG

Fixes broken link-style headings flagged in Copilot review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server-name is re-read from config on every player join instead of being cached Email body does not include server name

2 participants