
UUID Parsing to player Name
offup opened this issue ยท 7 comments
Skript/Server Version
[18:04:10 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[18:04:10 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[18:04:10 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[18:04:10 INFO]: [Skript] Server Version: 1.21.8-27-a664311 (MC: 1.21.8)
[18:04:10 INFO]: [Skript] Skript Version: 2.12.1 (skriptlang-github)
[18:04:10 INFO]: [Skript] Installed Skript Addons:
[18:04:10 INFO]: [Skript] - SkBee v3.12.3 (https://github.com/ShaneBeee/SkBee)
[18:04:10 INFO]: [Skript] - skript-db v1.6.0
[18:04:10 INFO]: [Skript] Installed dependencies:
[18:04:10 INFO]: [Skript] - Vault v1.7.3-b131
Bug Description
The bug happens if you try to get the name with an uuid.
Like: !broadcast name of offlineplayer(687ad06c-0bf1-4aa4-af9e-49d97f4104b7)
This happens when the player never joined the Server before.
Expected Behavior
Steps to Reproduce
Like: !broadcast name of offlineplayer("4d7a922a-dbd9-4edf-8b1c-a9be813fca4a")
or idk: !broadcast name of offlineplayer(4d7a922a-dbd9-4edf-8b1c-a9be813fca4a)
Errors or Screenshots

Other
No response
Agreement
- I have read the guidelines above and affirm I am following them with this report.
Likely due to Paper's PlayerProfile changes that lazy-load everything instead of preloading it. See the semi-recent bug fix for the skull of player expression.
This is speculation, though, and I have not confirmed
I have a plausible fix which u can use if u use skript-reflect or they could implement it in skript. The problem is that this involves making a get request to the mojang API. I doubt there's any other way to do it though.
UUID uuid = UUID.fromString("834c3d5a-e8b5-4419-85d9-939fea84fa16"); // Sample UUID
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.minecraftservices.com/minecraft/profile/lookup/" + uuid ))
.build();
try {
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() != 404) {
JsonObject object = JsonParser.parseString(response.body()).getAsJsonObject();
getLogger().info(object.get("name").getAsString());
} else {
getLogger().info("not found");
}
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
To implement this into skript would be fairly easy but because of it containing an asynchronous request I doubt they will. They'd just have to change code here.
Likely due to Paper's PlayerProfile changes that lazy-load everything instead of preloading it. See the semi-recent bug fix for the skull of player expression.
This is speculation, though, and I have not confirmed
This is almost correct, it's just that we use getOfflinePlayer(UUID) if you supply a uuid, which doesn't do lookups intentionally. We can just make a request via PlayerProfile.complete()
if the name is requested and not present, or we could complete the profile when the user creates the offline player. It just depends when we want the lag spike to occur. Opinions welcome.
Likely due to Paper's PlayerProfile changes that lazy-load everything instead of preloading it. See the semi-recent bug fix for the skull of player expression.
This is speculation, though, and I have not confirmedThis is almost correct, it's just that we use getOfflinePlayer(UUID) if you supply a uuid, which doesn't do lookups intentionally. We can just make a request via
PlayerProfile.complete()
if the name is requested and not present, or we could complete the profile when the user creates the offline player. It just depends when we want the lag spike to occur. Opinions welcome.
I think it would be the best to add a extra function or make it so when the profil was not found so it completes the profile.
I think it would be the best to add a extra function or make it so when the profil was not found so it completes the profile.
The profile should always be found no? Just whether it's completed or not is the issue. You can find an offline player who's never joined before but it's not going to be completed.