Skip to content

Commit

Permalink
SLightly tweak options
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 29, 2024
1 parent 2a77971 commit 35458a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion proto/src/main/proto/soulfire/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ message SettingsNamespace {
enum GlobalPermission {
CREATE_INSTANCE = 0;
SUBSCRIBE_LOGS = 1;
SERVER_CONFIG = 2;
READ_CLIENT_DATA = 2;
READ_SERVER_CONFIG = 3;
UPDATE_SERVER_CONFIG = 4;
}

enum InstancePermission {
Expand Down
1 change: 1 addition & 0 deletions proto/src/main/proto/soulfire/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ message ServerPlugin {
}

message ClientDataResponse {
string id = 6;
string username = 1;
repeated GlobalPermissionState serverPermissions = 2;
repeated ServerPlugin plugins = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ private Collection<ServerPlugin> getPlugins() {
@Override
public void getClientData(
ClientDataRequest request, StreamObserver<ClientDataResponse> responseObserver) {
ServerRPCConstants.USER_CONTEXT_KEY.get().hasPermissionOrThrow(PermissionContext.global(GlobalPermission.SERVER_CONFIG));
ServerRPCConstants.USER_CONTEXT_KEY.get().hasPermissionOrThrow(PermissionContext.global(GlobalPermission.READ_CLIENT_DATA));

try {
var currentUSer = ServerRPCConstants.USER_CONTEXT_KEY.get();
responseObserver.onNext(
ClientDataResponse.newBuilder()
.setUsername(ServerRPCConstants.USER_CONTEXT_KEY.get().getUsername())
.setId(currentUSer.getUniqueId().toString())
.setUsername(currentUSer.getUsername())
.addAllServerPermissions(getGlobalPermissions())
.addAllPlugins(getPlugins())
.addAllSettings(soulFireServer.serverSettingsRegistry().exportSettingsMeta())
Expand Down

0 comments on commit 35458a7

Please sign in to comment.