Skip to content

Commit 7d97fb5

Browse files
fix: change Mojang API endpoint to minecraftservices.com
old endpoint still works but idk
1 parent da4683d commit 7d97fb5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/kotlin/gg/skytils/skytilsmod/utils/MojangUtil.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ object MojangUtil {
6868
suspend fun getUUIDFromUsername(name: String): UUID? {
6969
val username = name.lowercase()
7070
return usernameToUuid.getIfPresent(username) ?: run {
71-
makeMojangRequest("https://api.mojang.com/users/profiles/minecraft/$username").let {
71+
makeMojangRequest("https://api.minecraftservices.com/minecraft/profile/lookup/name/$username").let {
7272
when (it.status) {
7373
HttpStatusCode.OK -> {
7474
val (id, _) = it.body<ProfileResponse>()
@@ -86,7 +86,7 @@ object MojangUtil {
8686

8787
suspend fun getUsernameFromUUID(uuid: UUID): String? {
8888
return uuidToUsername.getIfPresent(uuid) ?: run {
89-
makeMojangRequest("https://api.mojang.com/user/profile/${uuid}").let {
89+
makeMojangRequest("https://api.minecraftservices.com/minecraft/profile/lookup/${uuid}").let {
9090
when (it.status) {
9191
HttpStatusCode.OK -> {
9292
val (_, name) = it.body<ProfileResponse>()
@@ -114,7 +114,7 @@ object MojangUtil {
114114
*/
115115
private suspend fun makeMojangRequest(url: String): HttpResponse {
116116
if (requestCount.incrementAndGet() % 6 == 0) {
117-
client.get("https://api.mojang.com/users/profiles/minecraft/SlashSlayer?ts=${System.currentTimeMillis()}")
117+
client.get("https://api.minecraftservices.com/minecraft/profile/lookup/name/SlashSlayer?ts=${System.currentTimeMillis()}")
118118
}
119119
return client.get(url)
120120
}

0 commit comments

Comments
 (0)