fix: report unsupported server version at startup instead of misleading per-message errors - #39
Open
UltraGameCoder wants to merge 2 commits into
Open
Conversation
Owner
|
Include the detected server version in each log, so we don't have to ask when an issue is opened. |
Contributor
Author
|
Sounds good, I'll start by proposing the addition of the bukkit version. |
Add the server's Bukkit version to all three places that report a failure to resolve NMS/CraftBukkit classes, per review feedback on this PR: the constructor's ClassNotFoundException log, the constructor's "server not supported" summary log, and the exception thrown by queryMaterial when those classes were never resolved. Previously none of these included the actual version string, so diagnosing a report required asking the reporter for it separately.
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.
Problem
If the constructor's NMS/CraftBukkit class resolution fails (e.g. an
unsupported or unrecognized server version), the failure was only ever
printed to console via
e.printStackTrace()and then silently dropped.craftMagicNumbers/itemClazzare left null, butqueryMaterialdereferences them directly with no null check.
That dereference is caught by
queryMaterial's existing catch-all, so itdoesn't crash — but it gets wrapped into a generic
"[LocaleLib] Unable to query Material: X" error, repeated every single
time a player triggers a translated message, with nothing pointing at the
actual cause (the server version isn't supported).
Fix
e.printStackTrace()in the constructor withBukkit.getLogger().severe(...), and added one clear severe log lineat startup when NMS class resolution fails on a modern (1.13+) server,
so the real problem is visible immediately instead of only in a console
stack trace.
queryMaterialbefore attempting thereflection call, throwing a specific message ("NMS/CraftBukkit classes
were not resolved for this server version at startup") instead of
falling into the generic per-material catch-all.
Testing
Reviewed manually; behavior for supported server versions is unchanged.
No automated tests included with this PR.