From 29dead7c7cbed22fca5295ea0f02ed5ab2be6e6b Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 6 Apr 2024 21:44:42 +0100 Subject: [PATCH] fix web requests --- src/main/java/cc/fascinated/mojang/MojangAPIService.java | 4 ++-- src/main/java/cc/fascinated/util/WebRequest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/cc/fascinated/mojang/MojangAPIService.java b/src/main/java/cc/fascinated/mojang/MojangAPIService.java index b3aaa37..50da6b7 100644 --- a/src/main/java/cc/fascinated/mojang/MojangAPIService.java +++ b/src/main/java/cc/fascinated/mojang/MojangAPIService.java @@ -23,7 +23,7 @@ public class MojangAPIService { * @return the profile */ public MojangSessionServerProfile getSessionServerProfile(String id) { - return WebRequest.get(mojangSessionServerUrl + "/session/minecraft/profile/" + id); + return WebRequest.get(mojangSessionServerUrl + "/session/minecraft/profile/" + id, MojangSessionServerProfile.class); } /** @@ -33,6 +33,6 @@ public class MojangAPIService { * @return the profile */ public MojangApiProfile getApiProfile(String id) { - return WebRequest.get(mojangApiUrl + "/users/profiles/minecraft/" + id); + return WebRequest.get(mojangApiUrl + "/users/profiles/minecraft/" + id, MojangApiProfile.class); } } diff --git a/src/main/java/cc/fascinated/util/WebRequest.java b/src/main/java/cc/fascinated/util/WebRequest.java index 05d7b50..fb98de4 100644 --- a/src/main/java/cc/fascinated/util/WebRequest.java +++ b/src/main/java/cc/fascinated/util/WebRequest.java @@ -21,12 +21,12 @@ public class WebRequest { * @return the response * @param the type of the response */ - public static T get(String url) { + public static T get(String url, Class clazz) { try { ResponseEntity profile = CLIENT.get() .uri(url) .retrieve() - .toEntity((Class) Object.class); + .toEntity(clazz); if (profile.getStatusCode().isError()) { return null;