Repository navigation
feat(plugins): add a plugin which rotates server announcements - #1242
Merged
Merged
Conversation
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
Deploying openmudocs with
|
| Latest commit: |
a88fa73
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://42ed309b.openmudocs.pages.dev |
| Branch Preview URL: | https://claude-pr995-server-announce.openmudocs.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #995 (original plugin by @OviedoMarcelo), reworked to follow the coding rules.
What it does
The new
ServerAnnouncementsPlugIn(anIPeriodicTaskPlugIn, 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
Textis aLocalizedString, and every player sees the translation for theirCulture. The original sent one hardcoded string to everyone. The default example message is English, not Spanish.PlugInResources({Type}_{Property}_Name/_Description), with German translations. The original had literal Spanish descriptions.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 aConditionalWeakTablelikeGensRankingPlugIn, behind a lock.ForceStartnow shows the next announcement on the next check instead of doing nothing.PlayerLosesMoneyAfterDeathPlugInConfiguration.LossOfLevel. TheEquals/GetHashCodeoverrides weren't needed.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:First, Second, First)PlugInConfigurationJSON round trip with theLocalizedStringJsonConverterthe server registers at startup. Without the converter, the texts come backnull.Suites: Tests 1857, PlugIns 49, Web 242, Persistence.Initialization 638 (+7 skipped). All passed.
Checked in the admin panel (
-demomode): 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 otherTimeSpansettings.Generated by Claude Code