Skip to content

Commit

Permalink
Fix UUID lookup is not working on MC 1.20.4+ (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
yushijinhun committed Feb 17, 2024
1 parent da91095 commit 18d708d
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Haowei Wen <[email protected]> and contributors
* Copyright (C) 2024 Haowei Wen <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -49,12 +49,15 @@ public QueryUUIDsFilter(YggdrasilClient mojangClient, YggdrasilClient customClie

@Override
public boolean canHandle(String domain) {
return domain.equals("api.mojang.com");
return domain.equals("api.mojang.com") || domain.equals("api.minecraftservices.com");
}

@Override
public Optional<Response> handle(String domain, String path, IHTTPSession session) throws IOException {
if (domain.equals("api.mojang.com") && path.equals("/profiles/minecraft") && session.getMethod().equals("POST")) {
if (
(domain.equals("api.mojang.com") && path.equals("/profiles/minecraft") && session.getMethod().equals("POST")) ||
(domain.equals("api.minecraftservices.com") && path.equals("/minecraft/profile/lookup/bulk/byname") && session.getMethod().equals("POST"))
) {
Set<String> request = new LinkedHashSet<>();
asJsonArray(parseJson(asString(asBytes(session.getInputStream()))))
.forEach(element -> request.add(asJsonString(element)));
Expand Down

0 comments on commit 18d708d

Please sign in to comment.