Skip to content

Fix version parsing for Paper 26+#1

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

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

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented Apr 25, 2026

Summary

  • Bukkit.getBukkitVersion() on Paper 26.1.2 no longer matches the legacy <mc>-R<api>-SNAPSHOT format (it now looks like 26.1.2-build.41-alpha), so vstring.substring(0, vstring.lastIndexOf("-R")) produced a StringIndexOutOfBoundsException and aborted onEnable().
  • Replace the substring parser with a regex that extracts the leading numeric version, tolerating arbitrary suffixes.
  • Wrap the parser in a try/catch with a safe 1.20 fallback so a future format change can no longer prevent the plugin from enabling.

Mirrors the equivalent fix in PowerBoard (Xitee1/PowerBoard#76).

Fixes the crash:

java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 21
  at de.xite.smp.main.Main.onEnable(Main.java:57)

Test plan

  • Drop the built jar onto a Paper 26.1.2 server and confirm the plugin enables without StringIndexOutOfBoundsException
  • Confirm Main.MCVersion is set to a numeric string like 26.1.2
  • Confirm it still works on a Paper 1.20.x server

🤖 Generated with Claude Code

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, preventing the plugin from enabling.
Replace it with a regex that extracts only the leading numeric version,
tolerating arbitrary suffixes, and add a safe fallback so a parsing
failure no longer aborts onEnable().

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