Skip to content

Fix version parsing for Paper 26+ and null fallback#76

Merged
Xitee1 merged 1 commit into
masterfrom
fix/paper-26-version-parsing
Apr 19, 2026
Merged

Fix version parsing for Paper 26+ and null fallback#76
Xitee1 merged 1 commit into
masterfrom
fix/paper-26-version-parsing

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented Apr 19, 2026

Summary

  • Bukkit.getBukkitVersion() on Paper 26.1.2 no longer matches the legacy <mc>-R<api>-SNAPSHOT format, causing StringIndexOutOfBoundsException in Version.<clinit>. Replaced the substring parser with a regex that extracts the leading numeric version and tolerates arbitrary suffixes.
  • The catch-block fallback referenced Version.v1_13, but the constants were declared after the static block — so on any parse failure CURRENT became null and the isAbove_1_13 initializer threw NullPointerException. Moved the version constants above the static block so the fallback actually works.
  • On failure, the original Bukkit version string is now included in the error log to aid future diagnosis.

Test plan

  • Verified on Paper 26.1.2 — plugin enables and parses the version correctly
  • Sanity-check on an older Paper/Spigot (e.g. 1.20.x) that the legacy format still parses

Bukkit.getBukkitVersion() on Paper 26.1.2 no longer matches the legacy
"<mc>-R<api>-SNAPSHOT" format, so the substring-based parser produced a
StringIndexOutOfBoundsException. Replace it with a regex that extracts
only the leading numeric version, tolerating arbitrary suffixes.

The catch-block fallback referenced v1_13, but the constants were
declared after the static block, leaving them null at fallback time
and causing a NullPointerException on the isAbove_1_13 initializer.
Move the version constants above the static block so the fallback
actually yields a usable Version.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Xitee1 Xitee1 merged commit 4b55f43 into master Apr 19, 2026
1 check passed
@Xitee1 Xitee1 deleted the fix/paper-26-version-parsing branch April 19, 2026 08:12
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