diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java index 31d5a726..5d3fba8e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java @@ -17,6 +17,7 @@ import ru.gravit.launchserver.socket.websocket.json.auth.AuthResponse; import ru.gravit.launchserver.socket.websocket.json.auth.CheckServerResponse; import ru.gravit.launchserver.socket.websocket.json.auth.JoinServerResponse; +import ru.gravit.launchserver.socket.websocket.json.auth.ProfilesResponse; import ru.gravit.launchserver.socket.websocket.json.update.LauncherResponse; import ru.gravit.launchserver.socket.websocket.json.update.UpdateListResponse; import ru.gravit.utils.helper.LogHelper; @@ -69,6 +70,7 @@ public void registerResponses() { registerResponse("auth", AuthResponse.class); registerResponse("checkServer", CheckServerResponse.class); registerResponse("joinServer", JoinServerResponse.class); + registerResponse("profiles", ProfilesResponse.class); registerResponse("launcherUpdate", LauncherResponse.class); registerResponse("updateList", UpdateListResponse.class); registerResponse("cmdExec", UpdateListResponse.class); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/ProfilesResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/ProfilesResponse.java new file mode 100644 index 00000000..a4586bc2 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/ProfilesResponse.java @@ -0,0 +1,33 @@ +package ru.gravit.launchserver.socket.websocket.json.auth; + +import io.netty.channel.ChannelHandlerContext; +import ru.gravit.launcher.profiles.ClientProfile; +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.socket.Client; +import ru.gravit.launchserver.socket.websocket.WebSocketService; +import ru.gravit.launchserver.socket.websocket.json.JsonResponseInterface; + +import java.util.List; + +public class ProfilesResponse implements JsonResponseInterface { + @Override + public String getType() { + return "profiles"; + } + + @Override + public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception { + service.sendObject(ctx, new Result((List) LaunchServer.server.getProfiles())); + } + public class Result + { + List profiles; + + public Result(List profiles) { + this.profiles = profiles; + } + + String requesttype = "profilesList"; + String error; + } +}