Paradaux

PAR-299

0

Thin the PlayerInteract listener: move trade-context construction into TransactionService

Pending ReleaseNormalUnassignedChestShopImprovement

Design defect the earlier "deep dive" missed by only checking placement, not thinness: PlayerInteract was 359 lines — nearly double the next listener — because onInteract inlined the trade-click decision tree and preparePreTransactionContext (+ isAllowedForShift, getStackAmount) built the whole PreTransactionContext (account resolution, pricing incl. shift-sell modes, stacked items, virtual admin inventory). That's ~100 lines of service-level orchestration in an entrypoint, violating the thin-entrypoint layering rule.

Fix: move those three methods into TransactionService as public prepare(Sign, Player, Action) (+ the two private helpers). Every collaborator they use is already injected there, and it already owns validate/process/execute — so this completes the trade lifecycle (prepare → validate → process → execute) in one service. The listener calls transactions.prepare(...) and drops 3 now-unused dependencies (EconomyService, InventoryService, MaterialService).

Result: PlayerInteract 359 → 258 lines. :chestshop:build green; server enables cleanly; ChestShop suite 41/42 (known proprietor-settle flake; all trade tests pass through the relocated lifecycle).

Resources

Comments

No comments yet.

Activity

  • tesks changed status to Status → Pending Release
  • ParadauxIO linked a commit — Commit 5d836df — Thin PlayerInteract: move trade-context construction into TransactionService (PAR-299)
  • tesks created the issue