Skip to content

Fix full inventory handler correctness and scheduling - #294

Merged
BenCodez merged 19 commits into
masterfrom
fix/full-inventory-handler
Aug 24, 2026
Merged

BenCodez merged 19 commits into
masterfrom
fix/full-inventory-handler

Conversation

@BenCodez

@BenCodez BenCodez commented Aug 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix correctness and threading issues in FullInventoryHandler without changing its public add, check, giveItem, loadTimer, or getTimer API surface.

  • fix the existing items.put(null, current) merge bug
  • make pending-item merges atomic per UUID
  • avoid dereferencing offline players during sweeps
  • preserve the handler-owned executor exposed by getTimer() so legacy timer shutdown cannot affect GUI scheduling
  • recover cleanly if a legacy caller shuts down the exposed handler timer and later calls loadTimer()
  • keep the periodic handler timer isolated while handing Bukkit/global discovery back through the Bukkit scheduler
  • always route player-specific inventory/world work through the player-aware scheduler for Folia region ownership
  • keep actual inventory mutation in private owned-player methods
  • build a complete replacement persistence snapshot before writing it to ServerData
  • serialize snapshotting against in-flight delivery/requeue work with a fair read/write lock so shutdown saves cannot observe the temporary remove/re-add state
  • add explicit handler timer/task shutdown
  • make startup loading tolerate malformed UUID/item sections
  • replace raw stack traces with contextual logger warnings

Tests

Adds focused regression coverage for:

  • merging multiple pending item lists under the same UUID
  • offline-player sweeps
  • per-player scheduling from the pending sweep
  • direct check(Player) always using the player/entity scheduler
  • direct giveItem(...) always using the player/entity scheduler
  • handler timer isolation from AdvancedCore's shared inventory/GUI timer
  • restarting the handler timer after external shutdown
  • handler shutdown not affecting the shared GUI timer
  • completed snapshot persistence with one disk save and no intermediate persisted clear
  • concurrent shutdown save waiting for an in-flight delivery and persisting the finalized excess items

@BenCodez
BenCodez marked this pull request as ready for review August 24, 2026 01:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3a823869c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1254a1d85a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenCodez
BenCodez marked this pull request as draft August 24, 2026 01:50
@BenCodez
BenCodez marked this pull request as ready for review August 24, 2026 01:53
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce8c383ab8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenCodez
BenCodez marked this pull request as draft August 24, 2026 02:03
@BenCodez
BenCodez marked this pull request as ready for review August 24, 2026 02:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 162518b8ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f898aae46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenCodez
BenCodez marked this pull request as draft August 24, 2026 02:31
@BenCodez
BenCodez marked this pull request as ready for review August 24, 2026 02:36
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@BenCodez
BenCodez merged commit d96f1d3 into master Aug 24, 2026
4 checks passed
@BenCodez
BenCodez deleted the fix/full-inventory-handler branch August 24, 2026 22:51
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