uuidMap = new HashMap<>();
-
- int requests = (int) Math.ceil(names.size() / PROFILES_PER_REQUEST);
-
- for (int i = 0; i < requests; i++) {
- HttpURLConnection connection = createConnection();
- String body = JSONArray.toJSONString(names.subList(i * 100, Math.min((i + 1) * 100, names.size())));
- writeBody(connection, body);
- JSONArray array = (JSONArray) jsonParser.parse(new InputStreamReader(connection.getInputStream()));
- for (Object profile : array) {
- JSONObject jsonProfile = (JSONObject) profile;
- String id = (String) jsonProfile.get("id");
- String name = (String) jsonProfile.get("name");
- UUID uuid = UUIDFetcher.getUUID(id);
- uuidMap.put(name, uuid);
- }
- if (rateLimiting && i != requests - 1) {
- Thread.sleep(100L);
- }
- }
- return uuidMap;
- }
-
- private static void writeBody(HttpURLConnection connection, String body) throws Exception {
- OutputStream stream = connection.getOutputStream();
- stream.write(body.getBytes());
- stream.flush();
- stream.close();
- }
-
- private static HttpURLConnection createConnection() throws Exception {
- URL url = new URL(PROFILE_URL);
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("POST");
- connection.setRequestProperty("Content-Type", "application/json");
- connection.setUseCaches(false);
- connection.setDoInput(true);
- connection.setDoOutput(true);
- return connection;
- }
-
- private static UUID getUUID(String id) {
- return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
- }
-
- /**
- *
- * @param uuid
- * @return
- */
- public static byte[] toBytes(UUID uuid) {
- ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
- byteBuffer.putLong(uuid.getMostSignificantBits());
- byteBuffer.putLong(uuid.getLeastSignificantBits());
- return byteBuffer.array();
- }
-
- /**
- *
- * @param array
- * @return
- */
- public static UUID fromBytes(byte[] array) {
- if (array.length != 16) {
- throw new IllegalArgumentException("Illegal byte array length: " + array.length);
- }
- ByteBuffer byteBuffer = ByteBuffer.wrap(array);
- long mostSignificant = byteBuffer.getLong();
- long leastSignificant = byteBuffer.getLong();
- return new UUID(mostSignificant, leastSignificant);
- }
-
- /**
- *
- * @param name
- * @return
- * @throws Exception
- */
- public static UUID getUUIDOf(String name) throws Exception {
- return new UUIDFetcher(Arrays.asList(name)).call().get(name);
- }
-}
diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java
index 148d4a362..5fcdfedfa 100644
--- a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java
+++ b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java
@@ -5,6 +5,7 @@
*/
package main.java.com.djrapitops.plan.utilities.uuid;
+import com.djrapitops.javaplugin.utilities.UUIDFetcher;
import java.sql.SQLException;
import java.util.UUID;
import main.java.com.djrapitops.plan.Log;
diff --git a/Plan/src/main/resources/analysis.html b/Plan/src/main/resources/analysis.html
index d2510367f..08eb6f426 100644
--- a/Plan/src/main/resources/analysis.html
+++ b/Plan/src/main/resources/analysis.html
@@ -282,7 +282,7 @@ header p {
@@ -498,7 +498,7 @@ header p {
- Unique Playes: %uniquejoinsmonth% | Unique/Day: %avguniquejoinsmonth%
+ Unique Players: %uniquejoinsmonth% | Unique/Day: %avguniquejoinsmonth%
@@ -766,6 +766,9 @@ header p {
-
+
-
+