diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/NameFetcher.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/NameFetcher.java index ca02a61..cceb737 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/NameFetcher.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/NameFetcher.java @@ -37,5 +37,6 @@ public class NameFetcher { public static class Name { private String name; + private long changedToAt; } } \ No newline at end of file diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java index 0a88842..72ddc69 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java @@ -7,6 +7,7 @@ package com.imaginarycode.minecraft.redisbungee.util; import com.google.common.base.Charsets; +import com.google.common.collect.Iterables; import com.imaginarycode.minecraft.redisbungee.RedisBungee; import lombok.Getter; import lombok.NonNull; @@ -16,10 +17,7 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; import redis.clients.jedis.exceptions.JedisException; -import java.util.Calendar; -import java.util.Collections; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.regex.Pattern; @@ -155,7 +153,8 @@ public final class UUIDTranslator { // That didn't work. Let's ask Mojang. This call may fail, because Mojang is insane. String name; try { - name = NameFetcher.nameHistoryFromUuid(player).get(0); + List nameHist = NameFetcher.nameHistoryFromUuid(player); + name = Iterables.getLast(nameHist, null); } catch (Exception e) { plugin.getLogger().log(Level.SEVERE, "Unable to fetch name from Mojang for " + player, e); return null;