diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/skinhelper/SkinHelperUI.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/skinhelper/SkinHelperUI.java index 5994e634c..01aeea6aa 100644 --- a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/skinhelper/SkinHelperUI.java +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/skinhelper/SkinHelperUI.java @@ -5,6 +5,8 @@ import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; import mineplex.googlesheets.util.SkinFetcher; @@ -13,6 +15,8 @@ import mineplex.googlesheets.util.UUIDFetcher; public class SkinHelperUI extends JFrame { + private static final Map UUID_CACHE = new HashMap<>(); + private static final Font FONT = new Font("Verdana", Font.PLAIN, 12); private static final long FETCH_WAIT_TIME = 30; private static final long FETCH_WAIT_MILLISECONDS = TimeUnit.SECONDS.toMillis(FETCH_WAIT_TIME); @@ -97,7 +101,16 @@ public class SkinHelperUI extends JFrame try { - String[] skinData = SkinFetcher.getSkinData(UUIDFetcher.getPlayerUUIDNoDashes(txtMinecraftName.getText())); + String input = txtMinecraftName.getText(); + String uuid = UUID_CACHE.get(input); + + if (uuid == null) + { + uuid = UUIDFetcher.getPlayerUUIDNoDashes(input); + UUID_CACHE.put(input, uuid); + } + + String[] skinData = SkinFetcher.getSkinData(uuid); txtSkinValue.setText(skinData[0]); txtSkinSignature.setText(skinData[1]); diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/util/SkinFetcher.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/util/SkinFetcher.java index a8bdf6666..cbc9d02a1 100644 --- a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/util/SkinFetcher.java +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/util/SkinFetcher.java @@ -14,28 +14,11 @@ public class SkinFetcher JSONObject object = UtilJSON.getFromURL(SKIN_URL.replaceFirst("UUID", uuid)); JSONArray properties = (JSONArray) object.get("properties"); - System.out.println(properties.size()); - - for (Object o : properties) - { - System.out.println(o.toString()); - } - JSONObject innerObject = (JSONObject) properties.get(0); - System.out.println(innerObject.size()); - - for (Object o : innerObject.entrySet()) - { - System.out.println(o.toString()); - } - skinData[1] = (String) innerObject.get("signature"); skinData[0] = (String) innerObject.get("value"); - System.out.println(skinData[0]); - System.out.println(skinData[1]); - return skinData; }