You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to require a command source has op permission in Fabric 1.19, command registry completely fails and players cannot join the server if source.hasPermission is called. Logs attached at the bottom! :)
Start a server running the latest (as of 6/26/2022) versions of Fabric API, Architectury, Rhino, and KubeJS for 1.19
Place the following lines somewhere in a script in server_scripts on a multiplayer server
// priority: 0onEvent('command.registry',event=>{const{commands: Commands,arguments: Arguments}=event;event.register(Commands.literal("perms_test").requires(source=>source.getServer().isSingleplayer()||source.hasPermission(2)).executes((ctx)=>{ctx.source.sendSuccess("You have permission!",false);return1;}))})
Reload or start the server and try to join from your minecraft client
The client will be unable to join, receiving the message "Invalid player data".
In the server console, the following exception is thrown: dev.latvian.mods.rhino.EcmaError: TypeError: Cannot find function hasPermission in object net.minecraft.class_2168@4aeae43a. (server_scripts:perms_test.js#6)
Your script has an error elsewhere: ctx.source.sendSuccess("You have permission!"); needs to be ctx.source.sendSuccess("You have permission!", true); to broadcast command feedback to admins or ctx.source.sendSuccess("You have permission!", false) to send the message to the player only;
Seeing as this is a Rhino issue, I'm going to be moving the discussion there. It seems this issue applies to all methods inherited without an override(?), or at least I've been able to verify it with both abstract and default interface methods at least, and am going to try to verify it with abstract methods in abstract classes as well
When trying to require a command source has op permission in Fabric 1.19, command registry completely fails and players cannot join the server if
source.hasPermission
is called.Logs attached at the bottom! :)
Builds:
architectury-5.7.28-fabric
kubejs-fabric-1900.5.5-build.19
fabric-api-0.56.3+1.19.jar
rhino-fabric-1802.1.14-build.190.jar
To replicate:
server_scripts
on a multiplayer serverdev.latvian.mods.rhino.EcmaError: TypeError: Cannot find function hasPermission in object net.minecraft.class_2168@4aeae43a. (server_scripts:perms_test.js#6)
Debug logs:
logs/kubejs/startup.txt
logs/latest.log
Workaround:
Replace line 6 with:
The issue is that you cannot select individual permission levels, but this should be fine for 99% of use cases
The text was updated successfully, but these errors were encountered: