Skip to content

Move connected state into CorePlayer class#71

Merged
EarthCow merged 1 commit into
devfrom
improvement/move-connected-state-to-core-player
Jun 13, 2026
Merged

Move connected state into CorePlayer class#71
EarthCow merged 1 commit into
devfrom
improvement/move-connected-state-to-core-player

Conversation

@EarthCow

Copy link
Copy Markdown
Contributor

Replaces onlinePlayers from PlayerStateStore with a CorePlayer connected field. This was changed to keep the connected state bound to the CorePlayer object lifecycle.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 54d4fbb3-c39e-4727-851a-3bc8716db975

📥 Commits

Reviewing files that changed from the base of the PR and between 84af437 and 4af3167.

📒 Files selected for processing (4)
  • src/main/java/xyz/earthcow/networkjoinmessages/common/abstraction/CorePlayer.java
  • src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePlayerListener.java
  • src/main/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStore.java
  • src/test/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStoreTest.java
💤 Files with no reviewable changes (2)
  • src/test/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStoreTest.java
  • src/main/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStore.java

📝 Walkthrough

New Features

  • CorePlayer class now includes a connected field to track whether a player is currently connected

Improvements

  • CorePlayerListener updated to use CorePlayer's connection state tracking via isConnected() and setConnected() instead of PlayerStateStore, binding the connected state to the CorePlayer lifecycle
  • Test suite simplified by removing obsolete connected state test cases from PlayerStateStore

Development

  • Removed isConnected(CorePlayer) and setConnected(CorePlayer, boolean) public methods from PlayerStateStore, as connection tracking responsibility has been moved to CorePlayer
  • CorePlayerListener refactored to depend on CorePlayer for connection state management instead of PlayerStateStore

Walkthrough

This PR relocates player connection state tracking from the persistent PlayerStateStore to the in-memory CorePlayer abstraction. CorePlayer gains a connected boolean field, PlayerStateStore removes its connection-tracking methods and set, and CorePlayerListener updates all guards and state assignments to read/write from CorePlayer directly. Obsolete connection tests are removed.

Changes

Connection State Relocation

Layer / File(s) Summary
Add connection state field to CorePlayer
src/main/java/xyz/earthcow/networkjoinmessages/common/abstraction/CorePlayer.java
CorePlayer introduces a private boolean connected field initialized to false, establishing the in-memory source of truth for player connection tracking.
Remove connection tracking from PlayerStateStore
src/main/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStore.java
The onlinePlayers tracking set and public isConnected() / setConnected() methods are removed; the store retains only suppression and persisted per-player state.
Update CorePlayerListener to use player connection state
src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePlayerListener.java
Join routing, join handling, leave guards, and cleanup all read or write player connection state via CorePlayer methods instead of PlayerStateStore; the explicit state-store reset is removed from cleanup.
Remove connection state tests
src/test/java/xyz/earthcow/networkjoinmessages/common/player/PlayerStateStoreTest.java
Test cases for the removed isConnected / setConnected methods are deleted.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A player's heartbeat shifts its home,
from store to soul, a sleeker roam—
In-memory lives, no disk to roam,
the listener breathes without a tome. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: moving the connected state from PlayerStateStore into the CorePlayer class.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvement/move-connected-state-to-core-player

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

@EarthCow

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@EarthCow EarthCow merged commit 970bf26 into dev Jun 13, 2026
2 checks passed
@EarthCow EarthCow deleted the improvement/move-connected-state-to-core-player branch June 13, 2026 02:59
@coderabbitai coderabbitai Bot mentioned this pull request Jun 13, 2026
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