Skip to content

fix(rename): force rename reuses occupant UUID and overwrites their data - #191

Open
MCForgeTitle123 wants to merge 1 commit into
EndlessPixel-Studio:masterfrom
MCForgeTitle123:fix/rename-force-name-release
Open

MCForgeTitle123 wants to merge 1 commit into
EndlessPixel-Studio:masterfrom
MCForgeTitle123:fix/rename-force-name-release

Conversation

@MCForgeTitle123

Copy link
Copy Markdown
Contributor

Bug

When /fp rename <old> <new> --force targets a name held by another online fake player, renameAsync called remove(occupant). That cleanup only unregisters the sequence name and never releases the name -> UUID binding in profileRepository.

As a result the following getSpecifiedName(creator, newName) found the stale binding and reused the occupant's UUID:

  • the renamed fake player ends up with the occupant's identity, and
  • PlayerDataMigration.migrate(oldUuid, occupantUuid) overwrites the occupant's player data (inventory/stats/advancements).

The offline-fake-player branch already calls nameManager.releaseName(...) for exactly this reason; the online-occupant branch was missing it.

Fix

Call nameManager.releaseName(validated) right after removing the online occupant, so the new name gets a fresh UUID binding.

Verification

  • :fakeplayer-core:compileJava and :fakeplayer-core:spotlessCheck green.

renameAsync's force branch for an online occupant called remove(occupant),
which only unregisters the sequence name but leaves the 'name -> UUID'
binding in profileRepository. The subsequent getSpecifiedName then reused
that stale UUID, so the renamed fake player inherited the occupant's
identity and PlayerDataMigration overwrote the occupant's player data.

Release the name binding after removing an online occupant, matching the
existing offline-fake-player branch.
@github-actions github-actions Bot added the core 核心模块 fakeplayer-core label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core 核心模块 fakeplayer-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant