From 52609413a269dd588a9b2d2a8b6f8d837c6998a9 Mon Sep 17 00:00:00 2001 From: Gravit Date: Mon, 28 Jan 2019 21:39:23 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9F=D0=BE=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=8B=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../websocket/json/auth/ProfilesResponse.java | 4 ++ .../json/profile/BatchProfileByUsername.java | 41 ++++++++++++ .../json/profile/ProfileByUUIDResponse.java | 62 +++++++++++++++++++ .../json/profile/ProfileByUsername.java | 37 +++++++++++ 4 files changed, 144 insertions(+) create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/ProfileByUUIDResponse.java create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/ProfileByUsername.java 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 index a4586bc2..f08f71c1 100644 --- 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 @@ -17,6 +17,10 @@ public String getType() { @Override public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception { + if(!client.isAuth) + { + service.sendObject(ctx, new WebSocketService.ErrorResult("Access denied")); + } service.sendObject(ctx, new Result((List) LaunchServer.server.getProfiles())); } public class Result diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java new file mode 100644 index 00000000..d18c3d05 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/profile/BatchProfileByUsername.java @@ -0,0 +1,41 @@ +package ru.gravit.launchserver.socket.websocket.json.profile; + +import io.netty.channel.ChannelHandlerContext; +import ru.gravit.launcher.profiles.PlayerProfile; +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.UUID; + +public class BatchProfileByUsername implements JsonResponseInterface { + class Entry + { + String username; + String client; + } + Entry[] list; + @Override + public String getType() { + return "batchProfileByUsername"; + } + + @Override + public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception { + Result result = new Result(); + result.playerProfiles = new PlayerProfile[list.length]; + for(int i=0;i