[FIX] Унификация Results

This commit is contained in:
Gravit 2019-02-10 15:38:48 +07:00
parent 5b22989e57
commit 746fdc36e4
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
19 changed files with 75 additions and 62 deletions

View file

@ -215,7 +215,7 @@ function doAuth(login, rsaPassword) {
overlay.show(processing.overlay, function (event) { overlay.show(processing.overlay, function (event) {
FunctionalBridge.getHWID.join(); FunctionalBridge.getHWID.join();
makeAuthRequest(login, rsaPassword, function (result) { makeAuthRequest(login, rsaPassword, function (result) {
loginData = { pp: result.pp , accessToken: result.accessToken, permissions: result.permissions}; loginData = { pp: result.playerProfile , accessToken: result.accessToken, permissions: result.permissions};
overlay.hide(0, function () { overlay.hide(0, function () {
setCurrentScene(menuScene); setCurrentScene(menuScene);

View file

@ -19,26 +19,26 @@ public final class CompatBridge {
public static CompatProfile checkServer(String username, String serverID) throws Exception { public static CompatProfile checkServer(String username, String serverID) throws Exception {
LogHelper.debug("CompatBridge.checkServer, Username: '%s', Server ID: %s", username, serverID); LogHelper.debug("CompatBridge.checkServer, Username: '%s', Server ID: %s", username, serverID);
return CompatProfile.fromPlayerProfile(new CheckServerRequest(username, serverID).request()); return CompatProfile.fromPlayerProfile(new CheckServerRequest(username, serverID).request().playerProfile);
} }
public static boolean joinServer(String username, String accessToken, String serverID) throws Exception { public static boolean joinServer(String username, String accessToken, String serverID) throws Exception {
// Join server // Join server
LogHelper.debug("LegacyBridge.joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID); LogHelper.debug("LegacyBridge.joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID);
return new JoinServerRequest(username, accessToken, serverID).request(); return new JoinServerRequest(username, accessToken, serverID).request().allow;
} }
public static CompatProfile profileByUsername(String username) throws Exception { public static CompatProfile profileByUsername(String username) throws Exception {
return CompatProfile.fromPlayerProfile(new ProfileByUsernameRequest(username).request()); return CompatProfile.fromPlayerProfile(new ProfileByUsernameRequest(username).request().playerProfile);
} }
public static CompatProfile profileByUUID(UUID uuid) throws Exception { public static CompatProfile profileByUUID(UUID uuid) throws Exception {
return CompatProfile.fromPlayerProfile(new ProfileByUUIDRequest(uuid).request()); return CompatProfile.fromPlayerProfile(new ProfileByUUIDRequest(uuid).request().playerProfile);
} }
public static CompatProfile[] profilesByUsername(String... usernames) throws Exception { public static CompatProfile[] profilesByUsername(String... usernames) throws Exception {
PlayerProfile[] profiles = new BatchProfileByUsernameRequest(usernames).request(); PlayerProfile[] profiles = new BatchProfileByUsernameRequest(usernames).request().playerProfiles;
// Convert profiles // Convert profiles
CompatProfile[] resultProfiles = new CompatProfile[profiles.length]; CompatProfile[] resultProfiles = new CompatProfile[profiles.length];

View file

@ -32,7 +32,7 @@ public static String joinServer(String username, String accessToken, String serv
// Join server // Join server
LogHelper.debug("LegacyBridge.joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID); LogHelper.debug("LegacyBridge.joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID);
try { try {
return new JoinServerRequest(username, accessToken, serverID).request() ? "OK" : "Bad Login (Clientside)"; return new JoinServerRequest(username, accessToken, serverID).request().allow ? "OK" : "Bad Login (Clientside)";
} catch (Exception e) { } catch (Exception e) {
return e.toString(); return e.toString();
} }

View file

@ -43,7 +43,7 @@ public void findProfilesByNames(String[] usernames, Agent agent, ProfileLookupCa
// Batch Username-To-UUID request // Batch Username-To-UUID request
PlayerProfile[] sliceProfiles; PlayerProfile[] sliceProfiles;
try { try {
sliceProfiles = new BatchProfileByUsernameRequest(sliceUsernames).request(); sliceProfiles = new BatchProfileByUsernameRequest(sliceUsernames).request().playerProfiles;
} catch (Exception e) { } catch (Exception e) {
for (String username : sliceUsernames) { for (String username : sliceUsernames) {
LogHelper.debug("Couldn't find profile '%s': %s", username, e); LogHelper.debug("Couldn't find profile '%s': %s", username, e);

View file

@ -98,7 +98,7 @@ public GameProfile fillProfileProperties(GameProfile profile, boolean requireSec
// Make profile request // Make profile request
PlayerProfile pp; PlayerProfile pp;
try { try {
pp = new ProfileByUUIDRequest(uuid).request(); pp = new ProfileByUUIDRequest(uuid).request().playerProfile;
} catch (Exception e) { } catch (Exception e) {
LogHelper.debug("Couldn't fetch profile properties for '%s': %s", profile, e); LogHelper.debug("Couldn't fetch profile properties for '%s': %s", profile, e);
return profile; return profile;
@ -155,7 +155,7 @@ public GameProfile hasJoinedServer(GameProfile profile, String serverID) throws
// Make checkServer request // Make checkServer request
PlayerProfile pp; PlayerProfile pp;
try { try {
pp = new CheckServerRequest(username, serverID).request(); pp = new CheckServerRequest(username, serverID).request().playerProfile;
} catch (Exception e) { } catch (Exception e) {
LogHelper.error(e); LogHelper.error(e);
throw new AuthenticationUnavailableException(e); throw new AuthenticationUnavailableException(e);
@ -184,7 +184,7 @@ public void joinServer(GameProfile profile, String accessToken, String serverID)
// Make joinServer request // Make joinServer request
boolean success; boolean success;
try { try {
success = new JoinServerRequest(username, accessToken, serverID).request(); success = new JoinServerRequest(username, accessToken, serverID).request().allow;
} catch (Exception e) { } catch (Exception e) {
throw new AuthenticationUnavailableException(e); throw new AuthenticationUnavailableException(e);
} }

View file

@ -1,10 +1,10 @@
package ru.gravit.launcher.request.auth; package ru.gravit.launcher.request.auth;
import ru.gravit.launcher.*; import ru.gravit.launcher.*;
import ru.gravit.launcher.events.request.AuthRequestEvent;
import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.profiles.PlayerProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
import ru.gravit.launcher.request.auth.AuthRequest.Result;
import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HInput;
import ru.gravit.launcher.serialize.HOutput; import ru.gravit.launcher.serialize.HOutput;
import ru.gravit.launcher.serialize.SerializeLimits; import ru.gravit.launcher.serialize.SerializeLimits;
@ -13,21 +13,7 @@
import java.io.IOException; import java.io.IOException;
public final class AuthRequest extends Request<Result> { public final class AuthRequest extends Request<AuthRequestEvent> {
public static final class Result {
@LauncherAPI
public final PlayerProfile pp;
@LauncherAPI
public final String accessToken;
@LauncherAPI
public final ClientPermissions permissions;
private Result(PlayerProfile pp, String accessToken, ClientPermissions permissions) {
this.pp = pp;
this.accessToken = accessToken;
this.permissions = permissions;
}
}
private final String login; private final String login;
@ -102,7 +88,7 @@ public String getType() {
} }
}*/ }*/
@Override @Override
protected Result requestDo(HInput input, HOutput output) throws IOException { protected AuthRequestEvent requestDo(HInput input, HOutput output) throws IOException {
/*try { /*try {
LegacyRequestBridge.sendRequest(new EchoRequest("Hello World!")); LegacyRequestBridge.sendRequest(new EchoRequest("Hello World!"));
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -126,6 +112,6 @@ protected Result requestDo(HInput input, HOutput output) throws IOException {
PlayerProfile pp = new PlayerProfile(input); PlayerProfile pp = new PlayerProfile(input);
String accessToken = input.readASCII(-SecurityHelper.TOKEN_STRING_LENGTH); String accessToken = input.readASCII(-SecurityHelper.TOKEN_STRING_LENGTH);
ClientPermissions permissions = new ClientPermissions(input); ClientPermissions permissions = new ClientPermissions(input);
return new Result(pp, accessToken, permissions); return new AuthRequestEvent(pp, accessToken, permissions);
} }
} }

View file

@ -3,6 +3,7 @@
import ru.gravit.launcher.Launcher; import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.CheckServerEvent;
import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.profiles.PlayerProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
@ -14,7 +15,7 @@
import java.io.IOException; import java.io.IOException;
public final class CheckServerRequest extends Request<PlayerProfile> { public final class CheckServerRequest extends Request<CheckServerEvent> {
private final String username; private final String username;
private final String serverID; private final String serverID;
@ -36,7 +37,7 @@ public Integer getType() {
} }
@Override @Override
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException { protected CheckServerEvent requestDo(HInput input, HOutput output) throws IOException {
output.writeString(username, SerializeLimits.MAX_LOGIN); output.writeString(username, SerializeLimits.MAX_LOGIN);
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
if (Launcher.profile == null) { if (Launcher.profile == null) {
@ -48,6 +49,6 @@ protected PlayerProfile requestDo(HInput input, HOutput output) throws IOExcepti
// Read response // Read response
readError(input); readError(input);
return input.readBoolean() ? new PlayerProfile(input) : null; return input.readBoolean() ? new CheckServerEvent(new PlayerProfile(input)) : null;
} }
} }

View file

@ -2,6 +2,7 @@
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.JoinServerRequestEvent;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HInput;
@ -12,7 +13,7 @@
import java.io.IOException; import java.io.IOException;
public final class JoinServerRequest extends Request<Boolean> { public final class JoinServerRequest extends Request<JoinServerRequestEvent> {
// Instance // Instance
private final String username; private final String username;
@ -38,7 +39,7 @@ public Integer getType() {
} }
@Override @Override
protected Boolean requestDo(HInput input, HOutput output) throws IOException { protected JoinServerRequestEvent requestDo(HInput input, HOutput output) throws IOException {
output.writeString(username, SerializeLimits.MAX_LOGIN); output.writeString(username, SerializeLimits.MAX_LOGIN);
output.writeASCII(accessToken, -SecurityHelper.TOKEN_STRING_LENGTH); output.writeASCII(accessToken, -SecurityHelper.TOKEN_STRING_LENGTH);
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
@ -46,7 +47,7 @@ protected Boolean requestDo(HInput input, HOutput output) throws IOException {
// Read response // Read response
readError(input); readError(input);
return input.readBoolean(); return new JoinServerRequestEvent(input.readBoolean());
} }
} }

View file

@ -3,6 +3,7 @@
import ru.gravit.launcher.Launcher; import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.ProfilesRequestEvent;
import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
@ -13,16 +14,7 @@
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public final class ProfilesRequest extends Request<ProfilesRequest.Result> { public final class ProfilesRequest extends Request<ProfilesRequestEvent> {
public static final class Result {
@LauncherAPI
public final List<ClientProfile> profiles;
private Result(List<ClientProfile> profiles) {
this.profiles = Collections.unmodifiableList(profiles);
}
}
@LauncherAPI @LauncherAPI
public ProfilesRequest() { public ProfilesRequest() {
@ -40,7 +32,7 @@ public Integer getType() {
} }
@Override @Override
protected Result requestDo(HInput input, HOutput output) throws Exception { protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Exception {
output.writeBoolean(true); output.writeBoolean(true);
output.flush(); output.flush();
readError(input); readError(input);
@ -52,6 +44,6 @@ protected Result requestDo(HInput input, HOutput output) throws Exception {
profiles.add(Launcher.gson.fromJson(prof, ClientProfile.class)); profiles.add(Launcher.gson.fromJson(prof, ClientProfile.class));
} }
// Return request result // Return request result
return new Result(profiles); return new ProfilesRequestEvent(profiles);
} }
} }

View file

@ -2,6 +2,7 @@
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.BatchProfileByUsernameRequestEvent;
import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.profiles.PlayerProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
@ -13,7 +14,7 @@
import java.io.IOException; import java.io.IOException;
public final class BatchProfileByUsernameRequest extends Request<PlayerProfile[]> { public final class BatchProfileByUsernameRequest extends Request<BatchProfileByUsernameRequestEvent> {
private final String[] usernames; private final String[] usernames;
@LauncherAPI @LauncherAPI
@ -36,7 +37,7 @@ public Integer getType() {
} }
@Override @Override
protected PlayerProfile[] requestDo(HInput input, HOutput output) throws IOException { protected BatchProfileByUsernameRequestEvent requestDo(HInput input, HOutput output) throws IOException {
output.writeLength(usernames.length, SerializeLimits.MAX_BATCH_SIZE); output.writeLength(usernames.length, SerializeLimits.MAX_BATCH_SIZE);
for (String username : usernames) { for (String username : usernames) {
output.writeString(username, SerializeLimits.MAX_LOGIN); output.writeString(username, SerializeLimits.MAX_LOGIN);
@ -50,6 +51,6 @@ protected PlayerProfile[] requestDo(HInput input, HOutput output) throws IOExcep
profiles[i] = input.readBoolean() ? new PlayerProfile(input) : null; profiles[i] = input.readBoolean() ? new PlayerProfile(input) : null;
// Return result // Return result
return profiles; return new BatchProfileByUsernameRequestEvent(profiles);
} }
} }

View file

@ -3,6 +3,7 @@
import ru.gravit.launcher.Launcher; import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.ProfileByUUIDRequestEvent;
import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.profiles.PlayerProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
@ -14,7 +15,7 @@
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
public final class ProfileByUUIDRequest extends Request<PlayerProfile> { public final class ProfileByUUIDRequest extends Request<ProfileByUUIDRequestEvent> {
private final UUID uuid; private final UUID uuid;
@LauncherAPI @LauncherAPI
@ -34,12 +35,12 @@ public Integer getType() {
} }
@Override @Override
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException { protected ProfileByUUIDRequestEvent requestDo(HInput input, HOutput output) throws IOException {
output.writeUUID(uuid); output.writeUUID(uuid);
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.flush(); output.flush();
// Return profile // Return profile
return input.readBoolean() ? new PlayerProfile(input) : null; return input.readBoolean() ? new ProfileByUUIDRequestEvent(new PlayerProfile(input)) : null;
} }
} }

View file

@ -3,6 +3,7 @@
import ru.gravit.launcher.Launcher; import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.ProfileByUsernameRequestEvent;
import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.profiles.PlayerProfile;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.RequestType; import ru.gravit.launcher.request.RequestType;
@ -13,7 +14,7 @@
import java.io.IOException; import java.io.IOException;
public final class ProfileByUsernameRequest extends Request<PlayerProfile> { public final class ProfileByUsernameRequest extends Request<ProfileByUsernameRequestEvent> {
private final String username; private final String username;
@LauncherAPI @LauncherAPI
@ -33,11 +34,11 @@ public Integer getType() {
} }
@Override @Override
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException { protected ProfileByUsernameRequestEvent requestDo(HInput input, HOutput output) throws IOException {
output.writeString(username, SerializeLimits.MAX_LOGIN); output.writeString(username, SerializeLimits.MAX_LOGIN);
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT); output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.flush(); output.flush();
// Return profile // Return profile
return input.readBoolean() ? new PlayerProfile(input) : null; return input.readBoolean() ? new ProfileByUsernameRequestEvent(new PlayerProfile(input)) : null;
} }
} }

View file

@ -5,6 +5,7 @@
import ru.gravit.launcher.ClientPermissions; import ru.gravit.launcher.ClientPermissions;
import ru.gravit.launcher.Launcher; import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherConfig; import ru.gravit.launcher.LauncherConfig;
import ru.gravit.launcher.events.request.ProfilesRequestEvent;
import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.launcher.request.auth.AuthServerRequest; import ru.gravit.launcher.request.auth.AuthServerRequest;
import ru.gravit.launcher.request.update.ProfilesRequest; import ru.gravit.launcher.request.update.ProfilesRequest;
@ -43,7 +44,7 @@ public static boolean auth(ServerWrapper wrapper) {
try { try {
LauncherConfig cfg = Launcher.getConfig(); LauncherConfig cfg = Launcher.getConfig();
ServerWrapper.permissions = new AuthServerRequest(cfg, config.login, SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password)), 0, config.title).request(); ServerWrapper.permissions = new AuthServerRequest(cfg, config.login, SecurityHelper.newRSAEncryptCipher(cfg.publicKey).doFinal(IOHelper.encode(config.password)), 0, config.title).request();
ProfilesRequest.Result result = new ProfilesRequest(cfg).request(); ProfilesRequestEvent result = new ProfilesRequest(cfg).request();
for (ClientProfile p : result.profiles) { for (ClientProfile p : result.profiles) {
LogHelper.debug("Get profile: %s", p.getTitle()); LogHelper.debug("Get profile: %s", p.getTitle());
if (p.getTitle().equals(config.title)) { if (p.getTitle().equals(config.title)) {

View file

@ -17,6 +17,12 @@ public AuthRequestEvent() {
public PlayerProfile playerProfile; public PlayerProfile playerProfile;
public String accessToken; public String accessToken;
public AuthRequestEvent(PlayerProfile pp, String accessToken, ClientPermissions permissions) {
this.playerProfile = pp;
this.accessToken = accessToken;
this.permissions = permissions;
}
@Override @Override
public UUID getUUID() { public UUID getUUID() {
return uuid; return uuid;

View file

@ -11,6 +11,14 @@ public class BatchProfileByUsernameRequestEvent implements EventInterface, Resul
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3"); private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
public String error; public String error;
public PlayerProfile[] playerProfiles; public PlayerProfile[] playerProfiles;
public BatchProfileByUsernameRequestEvent(PlayerProfile[] profiles) {
this.playerProfiles = profiles;
}
public BatchProfileByUsernameRequestEvent() {
}
@Override @Override
public UUID getUUID() { public UUID getUUID() {
return uuid; return uuid;

View file

@ -11,6 +11,14 @@ public class CheckServerEvent implements EventInterface, ResultInterface {
public String type = "success"; public String type = "success";
public UUID uuid; public UUID uuid;
public PlayerProfile playerProfile; public PlayerProfile playerProfile;
public CheckServerEvent(PlayerProfile playerProfile) {
this.playerProfile = playerProfile;
}
public CheckServerEvent() {
}
@Override @Override
public UUID getUUID() { public UUID getUUID() {
return _uuid; return _uuid;

View file

@ -9,12 +9,16 @@
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface
{ {
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0"); private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
String error; public String error;
PlayerProfile playerProfile; public PlayerProfile playerProfile;
public ProfileByUUIDRequestEvent(PlayerProfile playerProfile) { public ProfileByUUIDRequestEvent(PlayerProfile playerProfile) {
this.playerProfile = playerProfile; this.playerProfile = playerProfile;
} }
public ProfileByUUIDRequestEvent() {
}
@Override @Override
public UUID getUUID() { public UUID getUUID() {
return uuid; return uuid;

View file

@ -9,8 +9,8 @@
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface
{ {
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1"); private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
String error; public String error;
PlayerProfile playerProfile; public PlayerProfile playerProfile;
public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) { public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) {
this.playerProfile = playerProfile; this.playerProfile = playerProfile;

View file

@ -10,12 +10,15 @@
public class ProfilesRequestEvent implements EventInterface, ResultInterface public class ProfilesRequestEvent implements EventInterface, ResultInterface
{ {
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1"); private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
List<ClientProfile> profiles; public List<ClientProfile> profiles;
public ProfilesRequestEvent(List<ClientProfile> profiles) { public ProfilesRequestEvent(List<ClientProfile> profiles) {
this.profiles = profiles; this.profiles = profiles;
} }
public ProfilesRequestEvent() {
}
String error; String error;
@Override @Override
public UUID getUUID() { public UUID getUUID() {