2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 10:38:01 +00:00

Remove cache, actually fix NameFetcher

This commit is contained in:
vemacs 2014-12-27 16:26:21 -07:00
parent e13a8de1d7
commit 5010670d95
2 changed files with 1 additions and 5 deletions

View File

@ -17,10 +17,7 @@ import java.net.URLConnection;
import java.util.*;
public class NameFetcher {
private static Map<UUID, List<String>> cache = new HashMap<>();
public static List<String> nameHistoryFromUuid(UUID uuid) {
if (cache.containsKey(uuid)) return cache.get(uuid);
URLConnection connection;
try {
connection = new URL("https://api.mojang.com/user/profiles/"
@ -30,7 +27,6 @@ public class NameFetcher {
Type listType = new TypeToken<List<String>>() {
}.getType();
List<String> list = new Gson().fromJson(text, listType);
cache.put(uuid, list);
return list;
} catch (IOException e) {
e.printStackTrace();

View File

@ -162,7 +162,7 @@ public final class UUIDTranslator {
// That didn't work. Let's ask Mojang. This call may fail, because Mojang is insane.
String name;
try {
name = new NameFetcher(Collections.singletonList(player)).call().get(player);
name = NameFetcher.nameHistoryFromUuid(player).get(0);
} catch (Exception e) {
plugin.getLogger().log(Level.SEVERE, "Unable to fetch name from Mojang for " + player, e);
return null;