use of com.mojang.authlib.yggdrasil.response.HasJoinedMinecraftServerResponse in project Krothium-Launcher by DarkLBP.
the class YggdrasilMinecraftSessionService method hasJoinedServer.
public GameProfile hasJoinedServer(GameProfile user, String serverId, InetAddress address) throws AuthenticationUnavailableException {
Map<String, Object> arguments = new HashMap();
arguments.put("username", user.getName());
arguments.put("serverId", serverId);
if (address != null) {
arguments.put("ip", address.getHostAddress());
}
URL url = HttpAuthenticationService.concatenateURL(CHECK_URL, HttpAuthenticationService.buildQuery(arguments));
try {
HasJoinedMinecraftServerResponse response = (HasJoinedMinecraftServerResponse) this.getAuthenticationService().makeRequest(url, (Object) null, HasJoinedMinecraftServerResponse.class);
if (response != null && response.getId() != null) {
GameProfile result = new GameProfile(response.getId(), user.getName());
if (response.getProperties() != null) {
result.getProperties().putAll(response.getProperties());
}
return result;
} else {
return null;
}
} catch (AuthenticationUnavailableException var8) {
throw var8;
} catch (AuthenticationException var9) {
return null;
}
}
Aggregations