Skip to content

Commit

Permalink
remove unused uuid function
Browse files Browse the repository at this point in the history
inexperienced users might think its a session id.
Which is why its not used for over two years but apparently still existed
  • Loading branch information
Ekwav committed Jun 7, 2024
1 parent 79e2183 commit e0cb151
Showing 1 changed file with 0 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,6 @@ public static class PlayerPosition
public float Pitch;

}

public static String getActivePlayerUUID() {
try {
URL url = new URL("https://api.mojang.com/profiles/minecraft");
HttpURLConnection con;
con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
con.setRequestProperty("Accept", "application/json");
con.setDoInput(true);
con.setDoOutput(true);

// ...

OutputStream os = con.getOutputStream();
byte[] bytes = ("[\"" + getUsername() + "\"]").getBytes("UTF-8");
os.write(bytes);
os.close();

InputStream in = new BufferedInputStream(con.getInputStream());
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
for (int length; (length = in.read(buffer)) != -1; ) {
result.write(buffer, 0, length);
}
// StandardCharsets.UTF_8.name() > JDK 7
String resString = result.toString("UTF-8");

System.out.println("Result= " + resString);
UUIDHelper[] helpers = WSClient.gson.fromJson(resString, UUIDHelper[].class);
if(helpers.length == 1) {
return helpers[0].id;
}


} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return UUID.randomUUID().toString();
}

public static String getUsername() {
String username = Minecraft.getSessionInfo().get("X-Minecraft-Username");
Expand Down

0 comments on commit e0cb151

Please sign in to comment.