mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
common: Add logging for UUID fetching errors in UUIDFetcher
This commit is contained in:
@@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import de.oliver.fancyanalytics.logger.ExtendedFancyLogger;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -31,12 +32,12 @@ public class UUIDFetcher {
|
||||
* @see UUIDFetcher#getUUIDAt(String, long)
|
||||
*/
|
||||
public static final long FEBRUARY_2015 = 1422748800000L;
|
||||
private static final ExtendedFancyLogger LOGGER = new ExtendedFancyLogger("UUIDFetcher");
|
||||
private static final String UUID_URL = "https://api.mojang.com/users/profiles/minecraft/%s?at=%d";
|
||||
private static final String NAME_URL = "https://api.mojang.com/user/profile/%s";
|
||||
private static Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
private static Map<String, UUID> uuidCache = new HashMap<String, UUID>();
|
||||
private static Map<UUID, String> nameCache = new HashMap<UUID, String>();
|
||||
|
||||
private static ExecutorService pool = Executors.newCachedThreadPool();
|
||||
|
||||
private String name;
|
||||
@@ -95,6 +96,8 @@ public class UUIDFetcher {
|
||||
|
||||
return data.id;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Could not fetch UUID for name: " + name);
|
||||
LOGGER.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -129,6 +132,8 @@ public class UUIDFetcher {
|
||||
|
||||
return currentNameData.name;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Could not fetch name for uuid: " + uuid);
|
||||
LOGGER.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user