Fix NPE during confirmation callback when player flow state is missing (Paper 1.21+)#77
Merged
BenCodez merged 1 commit intoBenCodez:mainfrom Nov 28, 2025
Merged
Conversation
…n no flow entry exists This patch resolves a NullPointerException triggered in PlayerActionListener.failed() when a confirmation callback fires after the associated player flow state has already been cleared or aborted. Instead of directly accessing a potentially null Map.Entry from the low map, the code now performs proper null checks and safely terminates the flow using fail-safe logic. This prevents scheduled tasks from crashing and avoids repeated console warnings such as: java.lang.NullPointerException: Cannot invoke 'Map.getValue()' because the return value of 'HashMap.get(Object)' is null This issue was triggered when fast player actions caused asynchronous confirmation callbacks to fire after the flow object was removed (e.g., cancelling, teleporting, rapid confirm/deny interactions). Patch tested on Paper 1.21.10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a NullPointerException that occurs inside PlayerActionListener$2.failed()
when a confirmation callback attempts to access a flow entry that no longer exists.
Paper 1.21.x tightened async behavior and timing windows, which exposed a race
condition in the confirmation system. If the player cancels, teleports, or otherwise
causes the flow to clear before the callback is executed, the
flow.get(uuid)callreturns null, causing an NPE: java.lang.NullPointerException: Cannot invoke "Map$Entry.getValue()"
What this PR changes
Why it's needed
This fixes active errors triggered by players on modern Paper servers.
The exception does not affect plot integrity but spams console and interrupts
confirmation logic.
This patch is backwards compatible with earlier Spigot/Paper versions.