mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE] Add ProfilesResponse WebSockets
This commit is contained in:
parent
01d6587c11
commit
9ea4c051d5
2 changed files with 35 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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<ClientProfile>) LaunchServer.server.getProfiles()));
|
||||
}
|
||||
public class Result
|
||||
{
|
||||
List<ClientProfile> profiles;
|
||||
|
||||
public Result(List<ClientProfile> profiles) {
|
||||
this.profiles = profiles;
|
||||
}
|
||||
|
||||
String requesttype = "profilesList";
|
||||
String error;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue