Skript

Skript

788k Downloads

unknown profile throws exception

TheLimeGlass opened this issue ยท 2 comments

commented

Skript/Server Version

2.12.1
mc 1.21.5

Bug Description

doing /example <offlineplayer> and /example 50 throws an exception

Expected Behavior

[05:18:42 WARN]: Couldn't find profile with name: 50
com.mojang.authlib.exceptions.MinecraftClientHttpException: Couldn't find any profile with name 50
        at com.mojang.authlib.minecraft.client.MinecraftClient.readInputStream(MinecraftClient.java:103) ~[authlib-6.0.58.jar:?]
        at com.mojang.authlib.minecraft.client.MinecraftClient.get(MinecraftClient.java:56) ~[authlib-6.0.58.jar:?]
        at com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository.findProfileByName(YggdrasilGameProfileRepository.java:116) ~[paper-1.21.5.jar:?]
        at net.minecraft.server.players.GameProfileCache.lookupGameProfile(GameProfileCache.java:83) ~[paper-1.21.5.jar:1.21.5-114-a1b3058]
        at net.minecraft.server.players.GameProfileCache.get(GameProfileCache.java:147) ~[paper-1.21.5.jar:1.21.5-114-a1b3058]
        at org.bukkit.craftbukkit.CraftServer.getOfflinePlayer(CraftServer.java:2094) ~[paper-1.21.5.jar:1.21.5-114-a1b3058]
        at org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:1530) ~[paper-api-1.21.5-R0.1-SNAPSHOT.jar:?]
        at Skript-2.12.1.jar/ch.njol.skript.classes.data.BukkitClasses$15.parse(BukkitClasses.java:735) ~[Skript-2.12.1.jar:?]

Steps to Reproduce

doing /example <offlineplayer> and /example 50 throws an exception

Errors or Screenshots

Should be caught, and print a runtime error, or preferably not at all since this command is mostly done by users in commands.

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

This exception is thrown by authlib and cannot be caught
Even Paper says to use a log filter:

Image

The only way seems to be sending an HTTP request before calling getOfflinePlayer to see if the profile exists first, which adds around 200ms to the execution time

Image

The best way is probably adding a config option (disabled by default) for the extra HTTP request

commented

An extra request is not a good idea. HTTP requests are a last resort if the player cannot be found in the cache; we should not be trying one each time.