Skip to content

Commit

Permalink
replaced mojang by playerdb api
Browse files Browse the repository at this point in the history
  • Loading branch information
doej1367 committed Dec 30, 2022
1 parent 6cf7d93 commit be87d2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.example.hyblockutils"
minSdkVersion 16
targetSdkVersion 30
versionCode 4
versionName "1.0.4"
versionCode 5
versionName "1.0.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 4,
"versionName": "1.0.4",
"versionCode": 5,
"versionName": "1.0.5",
"outputFile": "app-release.apk"
}
]
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/doej/hyblockutils/util/ApiRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import javax.net.ssl.HttpsURLConnection;

/**
*
* @author doej1367
*/
public class ApiRequest {
Expand All @@ -28,16 +27,17 @@ public ApiRequest() {

public String getUUID(String name) {
try {
return getJsonObjectFromApi("https://api.mojang.com/users/profiles/minecraft/" + name).getString("id");
return getJsonObjectFromApi("https://playerdb.co/api/player/minecraft/" + name)
.getJSONObject("data").getJSONObject("player").getString("raw_id");
} catch (JSONException e) {
return "<error>";
}
}

public String getName(String uuid) {
try {
JSONArray tmp = getJsonArrayFromApi("https://api.mojang.com/user/profiles/" + uuid + "/names");
return tmp.getJSONObject(tmp.length() - 1).getString("name");
JSONObject tmp = getJsonObjectFromApi("https://playerdb.co/api/player/minecraft/" + uuid);
return tmp.getJSONObject("data").getJSONObject("player").getString("username");
} catch (JSONException e) {
return "<error>";
}
Expand Down

0 comments on commit be87d2d

Please sign in to comment.