Skip to content

Register realm OOC chat when SimpleFactions enables after RPCharacters - #78

Merged
JustinasLa merged 1 commit into
mainfrom
fix/rooc-realm-resolver
Oct 8, 2026
Merged

JustinasLa merged 1 commit into
mainfrom
fix/rooc-realm-resolver

Conversation

@JustinasLa

Copy link
Copy Markdown
Contributor

What changes

/rooc (realm OOC chat) has never delivered a message on Main. Senders get "No one can hear you in this channel." and the console logs No chat recipient resolver registered for 'simplefactions:realm' (channel rooc) (once per session, e.g. 2026-10-02, 2026-10-04 and 2026-10-07; all seven /rooc uses in the last week failed).

onEnable only registered the simplefactions:realm resolver if SimpleFactions was already enabled. SimpleFactions depends on RPCharacters, so it always enables afterwards (on Main RPCharacters enables at latest.log line 2541, SimpleFactions at 2573) and the resolver was never registered.

  • New RealmChatDependencyListener registers the resolver when SimpleFactions enables (PluginEnableEvent), the same way PermadeathDependencyListener handles the permadeath bridge. It still registers at startup if SimpleFactions is already up (e.g. after a plugin reload).
  • It unregisters the resolver when SimpleFactions disables, so /rooc never calls into a disabled plugin.
  • onDisable uses the shared RESOLVER_ID constant.

No config, message or command changes.

Tests

  • New RealmChatDependencyListenerTest: no SimpleFactions → no resolver; SimpleFactions enabling after RPCharacters → realm members resolve; startup with SimpleFactions already enabled → resolves; SimpleFactions disabling → resolver removed; another plugin enabling → nothing.
  • Locally passing: RealmChatDependencyListenerTest, RealmOocChatRecipientResolverTest, ChatRecipientResolverRegistryTest, RPCharactersStartupTest, RPCharactersLifecycleTest (21 tests).

🤖 Generated with Claude Code

RPCharacters only registered the simplefactions:realm recipient resolver
if SimpleFactions was already enabled during onEnable. SimpleFactions
depends on RPCharacters, so it always enables later and /rooc never had
a resolver: every message reached nobody.

RealmChatDependencyListener registers the resolver at startup when
SimpleFactions is already up, on SimpleFactions' PluginEnableEvent, and
removes it on PluginDisableEvent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb642196-4f57-4d9c-9557-db32ec82f898
📥 Commits

Reviewing files that changed from the base of the PR and between f176e7e and a3fe737.

📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/rpcharacters/RPCharacters.java
  • src/main/java/net/tfminecraft/rpcharacters/factions/RealmChatDependencyListener.java
  • src/test/java/net/tfminecraft/rpcharacters/factions/RealmChatDependencyListenerTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Realm chat recipient support now becomes available when SimpleFactions is enabled, including when it is enabled after RPCharacters starts.
    • Realm chat recipient support is removed when SimpleFactions is disabled, preventing stale integrations.
    • Existing party chat recipient behaviour remains unchanged.

Walkthrough

RPCharacters now uses a dependency listener to manage the SimpleFactions realm-chat recipient resolver. The listener handles startup availability and plugin enable and disable events. Tests cover resolver registration and removal in these cases.

Changes

Realm-chat resolver lifecycle

Layer / File(s) Summary
Handle SimpleFactions availability
src/main/java/net/tfminecraft/rpcharacters/factions/RealmChatDependencyListener.java, src/test/java/net/tfminecraft/rpcharacters/factions/RealmChatDependencyListenerTest.java
The listener registers the resolver when SimpleFactions is enabled and unregisters it when SimpleFactions is disabled. Tests cover SimpleFactions being absent, enabled at startup or later, and disabled.
Wire listener into plugin lifecycle
src/main/java/net/tfminecraft/rpcharacters/RPCharacters.java
RPCharacters initialises and registers the listener, calls its startup registration method, and uses its resolver ID during shutdown cleanup. Party resolver cleanup remains unchanged.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant RPCharacters
  participant RealmChatDependencyListener
  participant PluginManager
  participant ResolverRegistry
  RPCharacters->>RealmChatDependencyListener: registerIfPresent()
  RealmChatDependencyListener->>PluginManager: Check whether SimpleFactions is enabled
  PluginManager-->>RealmChatDependencyListener: Enabled status
  RealmChatDependencyListener->>ResolverRegistry: Register realm resolver when enabled
  PluginManager->>RealmChatDependencyListener: Dispatch SimpleFactions disable event
  RealmChatDependencyListener->>ResolverRegistry: Unregister realm resolver
Loading

Merge Risk: ⚪ Minimal · up to a3fe7

The change appears ready to merge after normal checks; no unresolved realm-chat lifecycle issue is established.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JustinasLa
JustinasLa merged commit 628d185 into main Oct 8, 2026
2 checks passed
@JustinasLa
JustinasLa deleted the fix/rooc-realm-resolver branch October 8, 2026 00:51
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.

1 participant