MinecraftClientHttpException logged for unknown players in Bukkit#getOfflinePlayer(String)

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • This server is running CraftBukkit version 4493-Spigot-3dafb73-9f56109 (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
    • Yes

      Regression from 1.21.4.

      Calling the method Bukkit#getOfflinePlayer(String) with a username that is not owned by any minecraft account throws an exception. This contradicts the javadoc that states "This will return an object even if the player does not exist".

      I know this method is deprecated, but it is the encouraged method for username-to-player lookups from command.

      [15:26:15] [Server thread/WARN]: Couldn't find profile with name: nonexistent_user
      com.mojang.authlib.exceptions.MinecraftClientHttpException: Couldn't find any profile with name nonexistent_user
              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:109) ~[authlib-6.0.58.jar:?]
              at net.minecraft.server.players.UserCache.a(UserCache.java:78) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.players.UserCache.a(UserCache.java:130) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at org.bukkit.craftbukkit.v1_21_R4.CraftServer.getOfflinePlayer(CraftServer.java:1840) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:1263) ~[spigot-api-1.21.5-R0.1-SNAPSHOT.jar:?]
              at me.adamiok.getofflineplayerdemo.GetOfflinePlayerDemoPlugin.onCommand(GetOfflinePlayerDemoPlugin.java:14) ~[?:?]
              at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.21.5-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:150) ~[spigot-api-1.21.5-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.craftbukkit.v1_21_R4.CraftServer.dispatchCommand(CraftServer.java:924) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at org.bukkit.craftbukkit.v1_21_R4.CraftServer.dispatchServerCommand(CraftServer.java:909) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.dedicated.DedicatedServer.br(DedicatedServer.java:398) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.dedicated.DedicatedServer.G(DedicatedServer.java:374) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1532) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1362) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1068) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:325) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4493-Spigot-3dafb73-9f56109]
              at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
      

      Can be reproduced using the attached plugin:
      1. Set up a 1.21.5 spigot server
      2. Download the jar (or build from source) and place it in /plugins
      3. Start the server
      4. Run the command getofflineplayer nonexistent_user
      5. Observe how exception is logged

      Time: 40 min

            Assignee:
            Unassigned
            Reporter:
            Adamiok
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: