[1.21.6] Permission level check for `FabricClientCommandSource`
jebibot opened this issue ยท 5 comments
As of 1.21.6, net.minecraft.client.network.ClientCommandSource implements not only net.minecraft.command.CommandSource but also PermissionLevelSource.
It'd be useful if FabricClientCommandSource extend PermissionLevelSource and implement permission level checks.
I agree, I dont really think this is feasible as the behaviour will differ between single and multiplyer. You can still add your own checks for creative or op (does the client even know if its an op?) within your command.
I don't think it is the case. Permissions don't really make sense for client commands
@cputnam-a11y My use case is to show client-side debug commands, that have no meaning for normal users, only to OPs.
I thought this would work out of box, as ClientCommandSource implements PermissionLevelSource, but it doesn't. Its implementation also has changed from:
public boolean hasPermissionLevel(int level) {
ClientPlayerEntity clientPlayerEntity = this.client.player;
return clientPlayerEntity != null ? clientPlayerEntity.hasPermissionLevel(level) : level == 0;
}to:
public boolean hasPermissionLevel(int level) {
return this.elevatedPermissions || level == 0;
}and client commands are executed with elevatedPermissions = true.