Skip to content

feat(plugins): add a plugin which rotates server announcements - #1242

Merged
sven-n merged 1 commit into
masterfrom
claude/pr995-server-announcements
Oct 18, 2026
Merged

sven-n merged 1 commit into
masterfrom
claude/pr995-server-announcements

Conversation

@sven-n

@sven-n sven-n commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Split out of #995 (original plugin by @OviedoMarcelo), reworked to follow the coding rules.

What it does

The new ServerAnnouncementsPlugIn (an IPeriodicTaskPlugIn, disabled by default) shows a configured list of announcements to all players of a game server, one per interval. It goes through the list in order and starts over after the last one, so a game master doesn't have to keep typing rule reminders or community links.

Configuration (ServerAnnouncementsConfiguration):

  • Interval (TimeSpan, default 15 min; there's a 10 second minimum, so a zero interval doesn't send an announcement every second)
  • Announcements (ICollection<Announcement>, [MemberOfAggregate]), each with:
    • Text (LocalizedString)
    • Type (MessageType, default golden centre)

Changes compared to the original in #995

  • Localized texts (rule 10): Text is a LocalizedString, and every player sees the translation for their Culture. The original sent one hardcoded string to everyone. The default example message is English, not Spanish.
  • Resources: the plugin name/description and all configuration labels come from PlugInResources ({Type}_{Property}_Name/_Description), with German translations. The original had literal Spanish descriptions.
  • State: the original used a static ConcurrentDictionary<IGameContext, State>, which was never cleaned up. The rotation state now lives in the plugin instance (game servers in one process share a single plugin instance), in a ConditionalWeakTable like GensRankingPlugIn, behind a lock.
  • ForceStart now shows the next announcement on the next check instead of doing nothing.
  • The nested type is a nested class, like PlayerLosesMoneyAfterDeathPlugInConfiguration.LossOfLevel. The Equals/GetHashCode overrides weren't needed.
  • The plugin GUID from the original is kept, so the contributor's existing plugin configuration stays attached.
  • Docs: new section Server announcements in docs-website/docs/admin-panel/plugins.md.

It works with any MessageType. Once #1241 is merged, the slide notice is available here too.

Testing

ServerAnnouncementsPlugInTest:

  • shows one announcement per interval
  • rotates in order and starts over (First, Second, First)
  • a zero interval doesn't announce on every run
  • shows the player's translation
  • shows nothing without announcements
  • the configuration, including translations, survives a PlugInConfiguration JSON round trip with the LocalizedStringJsonConverter the server registers at startup. Without the converter, the texts come back null.

Suites: Tests 1857, PlugIns 49, Web 242, Persistence.Initialization 638 (+7 skipped). All passed.

Checked in the admin panel (-demo mode): the plugin is listed under Periodic Tasks, disabled by default, and its configuration form shows the interval, the announcement list with per-language text fields (en/de/zh-CN) and the message type selection. The interval shows in milliseconds, like the other TimeSpan settings.


Generated by Claude Code

Shows a configured list of announcements to all players of a game server,
one after another in a fixed interval, so that a game master doesn't have
to type recurring ones. Disabled by default.

Split out of #995 and reworked: the texts are LocalizedStrings which are
shown in the language of each player, the plugin and its configuration use
PlugInResources (with German translations), the rotation state lives in the
plugin instance per game context instead of a static dictionary, the
interval has a lower bound, and ForceStart shows the next announcement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uz47mrsSwm3hxZc7gCMxd9
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openmudocs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a88fa73
Status: ✅  Deploy successful!
Preview URL: https://42ed309b.openmudocs.pages.dev
Branch Preview URL: https://claude-pr995-server-announce.openmudocs.pages.dev

View logs

@sven-n
sven-n merged commit e73bbbc into master Oct 18, 2026
4 checks passed
@sven-n
sven-n deleted the claude/pr995-server-announcements branch October 18, 2026 09:18
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.

2 participants