Skip to content

Fix lock flag restoration after session reinitialization - #2304

Open
Brokkonaut wants to merge 1 commit into
EngineHub:version/7.0.xfrom
Brokkonaut:fix-lock-flag
Open

Fix lock flag restoration after session reinitialization#2304
Brokkonaut wants to merge 1 commit into
EngineHub:version/7.0.xfrom
Brokkonaut:fix-lock-flag

Conversation

@Brokkonaut

Copy link
Copy Markdown
Contributor

Summary

Fix player-specific weather and time state restoration when sessions are
reinitialized.

Players could remain stuck with the weather configured by a region's
weather-lock flag after leaving the region. This was reproducible when:

  • a new session was initialized while the player was inside a weather-locked
    region (for example login after the server was restarted) or
  • /wg flushstates was executed while the player was inside such a region.

Moving out of that region would not reset the weather/time to normal afterwards

Cause

New sessions were already initialized by SessionManager#get, but the
ProcessPlayerEvent handler initialized them a second time. During the second
initialization, the weather applied by WorldGuard was recorded as the player's
original weather.

Additionally, Session#resetState initialized handlers again without first
uninitializing them. Stateful handlers could therefore replace their original
player state with the state previously applied by the region flag.

Changes

  • Initialize newly created sessions only once.
  • Reinitialize cached sessions explicitly on player processing.
  • Restore handler-managed player state before reinitializing a session.

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