refactor(S-02/S-05): extract PlayerMovement component + fix thread safety
- Extract 11 movement fields from PlayerBindState into PlayerMovement component - Replace volatile isStruggling/struggleStartTick pair with atomic StruggleSnapshot record - Remove 5+2 misleading synchronized keywords (different monitors, all server-thread-only) - Update all 36 MovementStyleManager field accesses to use getMovement() getters/setters
This commit is contained in:
@@ -42,10 +42,9 @@ public class PlayerStruggle {
|
||||
* Entry point for the Struggle logic (Key R).
|
||||
* Distributes effort between Binds and Collar.
|
||||
*
|
||||
* Thread Safety: Synchronized to prevent lost updates when multiple struggle
|
||||
* packets arrive simultaneously (e.g., from macro/rapid keypresses).
|
||||
* Thread Safety: Must be called from the server thread (packet handlers use enqueueWork).
|
||||
*/
|
||||
public synchronized void struggle() {
|
||||
public void struggle() {
|
||||
if (struggleBindState != null) struggleBindState.struggle(state);
|
||||
if (struggleCollarState != null) struggleCollarState.struggle(state);
|
||||
}
|
||||
@@ -53,9 +52,9 @@ public class PlayerStruggle {
|
||||
/**
|
||||
* Restores resistance to base values when a master tightens the ties.
|
||||
*
|
||||
* Thread Safety: Synchronized to prevent race with struggle operations.
|
||||
* Thread Safety: Must be called from the server thread.
|
||||
*/
|
||||
public synchronized void tighten(Player tightener) {
|
||||
public void tighten(Player tightener) {
|
||||
if (struggleBindState != null) struggleBindState.tighten(
|
||||
tightener,
|
||||
state
|
||||
|
||||
Reference in New Issue
Block a user