Skip to content

fix: crash on player join (permissions) + client-side damage cast - #6

Merged
iSlavok merged 1 commit into
mainfrom
fix/runtime-crashes
Jul 27, 2026
Merged

fix: crash on player join (permissions) + client-side damage cast#6
iSlavok merged 1 commit into
mainfrom
fix/runtime-crashes

Conversation

@iSlavok

@iSlavok iSlavok commented Jul 27, 2026

Copy link
Copy Markdown
Owner

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

NoSuchMethodError: net.minecraft.command.CommandSource.method_9259(int)
  at me.lucko...Permissions.check
  at SafePermissionApi.check ... CommandNode.canUse ... sendCommandTree ... onPlayerConnect

fabric-permissions-api's Permissions.check(source, perm, int) does its op-level fallback via CommandSource#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 — ClassCastException log spam on hitting a frame

The pre-ServerWorld damage() fires client-side too, so (ServerWorld) frame.getWorld() threw on the client (caught + logged every hit). Fix: bail out when the world isn't a ServerWorld.

Verified

All 9 anchors build; gametests pass including the new permission-predicate check. (Client-side visual not GUI-tested here.)

- 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.
@iSlavok
iSlavok merged commit 57200e8 into main Jul 27, 2026
2 checks passed
@iSlavok
iSlavok deleted the fix/runtime-crashes branch July 27, 2026 10:33
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