fix: crash on player join (permissions) + client-side damage cast - #6
Merged
Conversation
- Player-join crash on 1.21.x: fabric-permissions-api's Permissions.check(source, perm, int) falls back through CommandSource#hasPermissionLevel via an intermediary that no longer resolves on newer versions -> NoSuchMethodError when the command tree is sent. Call Permissions.getPermissionValue(...) and do the op-level fallback from our own per-version-compiled code (hasPermissionLevel remaps correctly). - Log spam on <1.21.2: the pre-ServerWorld damage() fires client-side too, so (ServerWorld) frame.getWorld() threw ClassCastException on the client. Bail out when the world isn't a ServerWorld. - Gametest now evaluates the command permission predicate (would have caught the join crash — the smoke test never exercised it). All 9 anchors build; gametests (incl the new permission check) pass.
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.
Two runtime bugs found while testing (both on
main, so this should merge before the glint/name PRs).1.21.x — server crashes when a player joins
fabric-permissions-api'sPermissions.check(source, perm, int)does its op-level fallback viaCommandSource#hasPermissionLevel, referenced through an intermediary that no longer resolves on newer versions. When the command tree is sent to a joining player the predicate runs →NoSuchMethodError→ crash.Fix: call
Permissions.getPermissionValue(...)(queries LuckPerms etc.) and do the op-level fallback in our own code —source.hasPermissionLevel(level)compiled per-version is remapped correctly. The gametest now evaluates the command permission predicate, so this path is regression-tested (the smoke test never exercised it, which is why it slipped through).<1.21.2 —
ClassCastExceptionlog spam on hitting a frameThe pre-
ServerWorlddamage()fires client-side too, so(ServerWorld) frame.getWorld()threw on the client (caught + logged every hit). Fix: bail out when the world isn't aServerWorld.Verified
All 9 anchors build; gametests pass including the new permission-predicate check. (Client-side visual not GUI-tested here.)