Add Mojang api debug

This commit is contained in:
Colin McDonald 2016-07-02 17:38:56 -04:00
parent de9a490aa1
commit adb16d8c8d

View File

@ -6,17 +6,20 @@ import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.DecodeException; import io.vertx.core.json.DecodeException;
import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonObject;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import net.frozenorb.apiv3.APIv3; import net.frozenorb.apiv3.APIv3;
import java.io.IOException; import java.io.IOException;
import java.util.UUID; import java.util.UUID;
@Slf4j
@UtilityClass @UtilityClass
public class MojangUtils { public class MojangUtils {
private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true)); private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true));
public static void getName(UUID id, SingleResultCallback<String> callback) { public static void getName(UUID id, SingleResultCallback<String> callback) {
log.error("Getting name for " + id + "...");
httpsClient.get(443, "sessionserver.mojang.com", "/session/minecraft/profile/" + id.toString().replace("-", ""), (response) -> { httpsClient.get(443, "sessionserver.mojang.com", "/session/minecraft/profile/" + id.toString().replace("-", ""), (response) -> {
response.bodyHandler((body) -> { response.bodyHandler((body) -> {
try { try {