RedisBungee/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/NameFetcher.java

60 lines
2.1 KiB
Java
Raw Normal View History

2022-12-31 03:23:35 +00:00
/*
* Copyright (c) 2013-present RedisBungee contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
2022-07-16 12:50:09 +00:00
package com.imaginarycode.minecraft.redisbungee.api.util.uuid;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
2015-02-04 15:02:30 +00:00
import com.squareup.okhttp.OkHttpClient;
2015-01-25 05:17:52 +00:00
import com.squareup.okhttp.Request;
import com.squareup.okhttp.ResponseBody;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
2022-12-31 03:23:35 +00:00
@Deprecated
public class NameFetcher {
2015-02-04 15:02:30 +00:00
private static OkHttpClient httpClient;
private static final Gson gson = new Gson();
2022-12-31 03:23:35 +00:00
@Deprecated
public static void setHttpClient(OkHttpClient httpClient) {
2022-12-31 03:23:35 +00:00
throw new UnsupportedOperationException("Due mojang disabled the Names API NameFetcher no longer functions and has been disabled");
// NameFetcher.httpClient = httpClient;
}
2015-02-04 15:02:30 +00:00
2022-12-31 03:23:35 +00:00
@Deprecated
public static List<String> nameHistoryFromUuid(UUID uuid) throws IOException {
2022-12-31 03:23:35 +00:00
throw new UnsupportedOperationException("Due mojang disabled the Names API NameFetcher no longer functions and has been disabled");
// String url = "https://api.mojang.com/user/profiles/" + uuid.toString().replace("-", "") + "/names";
// Request request = new Request.Builder().url(url).get().build();
// ResponseBody body = httpClient.newCall(request).execute().body();
// String response = body.string();
// body.close();
//
// Type listType = new TypeToken<List<Name>>() {
// }.getType();
// List<Name> names = gson.fromJson(response, listType);
//
// List<String> humanNames = new ArrayList<>();
// for (Name name : names) {
// humanNames.add(name.name);
// }
// return humanNames;
}
2022-12-31 03:23:35 +00:00
@Deprecated
public static class Name {
private String name;
2015-02-04 14:55:45 +00:00
private long changedToAt;
}
}