This commit is contained in:
parent
efb3281818
commit
29dead7c7c
@ -23,7 +23,7 @@ public class MojangAPIService {
|
|||||||
* @return the profile
|
* @return the profile
|
||||||
*/
|
*/
|
||||||
public MojangSessionServerProfile getSessionServerProfile(String id) {
|
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
|
* @return the profile
|
||||||
*/
|
*/
|
||||||
public MojangApiProfile getApiProfile(String id) {
|
public MojangApiProfile getApiProfile(String id) {
|
||||||
return WebRequest.get(mojangApiUrl + "/users/profiles/minecraft/" + id);
|
return WebRequest.get(mojangApiUrl + "/users/profiles/minecraft/" + id, MojangApiProfile.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@ public class WebRequest {
|
|||||||
* @return the response
|
* @return the response
|
||||||
* @param <T> the type of the response
|
* @param <T> the type of the response
|
||||||
*/
|
*/
|
||||||
public static <T> T get(String url) {
|
public static <T> T get(String url, Class<T> clazz) {
|
||||||
try {
|
try {
|
||||||
ResponseEntity<T> profile = CLIENT.get()
|
ResponseEntity<T> profile = CLIENT.get()
|
||||||
.uri(url)
|
.uri(url)
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.toEntity((Class<T>) Object.class);
|
.toEntity(clazz);
|
||||||
|
|
||||||
if (profile.getStatusCode().isError()) {
|
if (profile.getStatusCode().isError()) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user