Skip to content

NameAndId class on MOTD packet in MC 1.21.10 #3570

@diogotcorreia

Description

@diogotcorreia
  • This issue is not solved in a development build

Describe the bug
When calling WrappedServerPing#getPlayers(), the following error is thrown:

[16:37:05 ERROR]: [Triton] Unhandled exception occurred in onAsyncPacket() for Triton
java.lang.IllegalArgumentException: handle (NameAndId[id=4f30295e-8084-45f7-8f00-48d3c2036c5f, name=Rexcantor64]) is not a class com.mojang.authlib.GameProfile, but class net.minecraft.server.players.NameAndId
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.AbstractWrapper.setHandle(AbstractWrapper.java:31) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.WrappedGameProfile.<init>(WrappedGameProfile.java:76) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.WrappedGameProfile.fromHandle(WrappedGameProfile.java:205) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.Converters$3.getSpecific(Converters.java:105) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.Converters$1.getSpecific(Converters.java:52) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.BukkitConverters.getSpecificList(BukkitConverters.java:327) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.BukkitConverters$3.getSpecific(BukkitConverters.java:371) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.BukkitConverters$3.getSpecific(BukkitConverters.java:368) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.Converters$1.getSpecific(Converters.java:52) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.ping.ServerPingRecord.getPlayers(ServerPingRecord.java:236) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.wrappers.WrappedServerPing.getPlayers(WrappedServerPing.java:257) ~[ProtocolLib.jar:?]
        at com.rexcantor64.triton.spigot.packetinterceptor.MotdPacketHandler.handleServerInfo(MotdPacketHandler.java:68) ~[?:?]
        at com.rexcantor64.triton.spigot.packetinterceptor.MotdPacketHandler.onPacketSending(MotdPacketHandler.java:121) ~[?:?]
        at ProtocolLib.jar/com.comphenix.protocol.async.AsyncListenerHandler.lambda$processPacket$4(AsyncListenerHandler.java:602) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.timing.TimingTracker.lambda$static$0(TimingTracker.java:7) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.async.AsyncListenerHandler.processPacket(AsyncListenerHandler.java:600) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.async.AsyncListenerHandler.listenerLoop(AsyncListenerHandler.java:572) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.async.AsyncListenerHandler$1.run(AsyncListenerHandler.java:217) ~[ProtocolLib.jar:?]
        at ProtocolLib.jar/com.comphenix.protocol.async.AsyncListenerHandler.lambda$start$1(AsyncListenerHandler.java:286) ~[ProtocolLib.jar:?]
        at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78) ~[purpur-1.21.10.jar:1.21.10-2518-ffe2f80]
        at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.10.jar:1.21.10-2518-ffe2f80]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.10.jar:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

This is because the type of the field changed from GameProfile to (the new?) NameAndId in 1.21.10.
This new NameAndId class is just a record with a UUID and a String (username).

To Reproduce
Steps to reproduce the behavior (requires two accounts, or an external service to ping the server):

  1. Join the server with the first account.
  2. Ping the server to get the MOTD, which will have a player in the response.
  3. Have a plugin intercept and try to call WrappedServerPing#getPlayers() in the status packet.

Expected behavior
I'm not sure how to handle this. We can make a WrappedNameAndId that's a subclass of WrappedGameProfile, but that wouldn't really be correct. Or somehow adapt WrappedGameProfile to use this class in certain situations.

Version Info

ProtocolLib Dump
ProtocolLib Dump
Timestamp: 10/31/25 17:02:27

ProtocolLib Version: ProtocolLib v5.4.1-SNAPSHOT-468082c
Bukkit Version: 1.21.10-R0.1-SNAPSHOT
Server Version: 1.21.10-2518-ffe2f80 (MC: 1.21.10)
Java Version: 21.0.8

ProtocolLib: com.comphenix.protocol.ProtocolLib@35ae12e4[
  statistics=com.comphenix.protocol.metrics.Statistics@76a37e2d
  packetTask=com.comphenix.protocol.scheduler.DefaultTask@788bb71e
  tickCounter=35879
  configExpectedMod=1
  updater=com.comphenix.protocol.updater.SpigotUpdater@64b05810
  redirectHandler=com.comphenix.protocol.ProtocolLib$2@214c4f50
  scheduler=com.comphenix.protocol.scheduler.DefaultScheduler@4c730f42
  commandProtocol=com.comphenix.protocol.CommandProtocol@69e57295
  commandPacket=com.comphenix.protocol.CommandPacket@ff3c761
  commandFilter=com.comphenix.protocol.CommandFilter@4c862f00
  packetLogging=com.comphenix.protocol.PacketLogging@185b20cd
  skipDisable=false
  isEnabled=true
  loader=io.papermc.paper.plugin.manager.DummyBukkitPluginLoader@5ae88889
  server=CraftServer{serverName=Purpur,serverVersion=1.21.10-2518-ffe2f80,minecraftVersion=1.21.10}
  file=plugins/ProtocolLib.jar
  description=org.bukkit.plugin.PluginDescriptionFile@36325c33
  pluginMeta=org.bukkit.plugin.PluginDescriptionFile@36325c33
  dataFolder=plugins/ProtocolLib
  classLoader=PluginClassLoader{plugin=ProtocolLib v5.4.1-SNAPSHOT-468082c, pluginEnabled=true, url=plugins/ProtocolLib.jar}
  naggable=true
  newConfig=YamlConfiguration[path='', root='YamlConfiguration']
  configFile=plugins/ProtocolLib/config.yml
  logger=com.destroystokyo.paper.utils.PaperPluginLogger@699c3dcc
  lifecycleEventManager=io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEventManager@2e49e6c1
  allowsLifecycleRegistration=false
  isBeingEnabled=false
]
Manager: com.comphenix.protocol.injector.PacketFilterManager@a3ef4ff[
  plugin=ProtocolLib v5.4.1-SNAPSHOT-468082c
  server=CraftServer{serverName=Purpur,serverVersion=1.21.10-2518-ffe2f80,minecraftVersion=1.21.10}
  reporter=com.comphenix.protocol.ProtocolLib$1@f6eff07
  minecraftVersion=(MC: 1.21.10)
  asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@794d17b
  pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@668a50a6
  mainThreadPacketTypes=com.comphenix.protocol.concurrent.PacketTypeListenerSet@1b6ed984
  inboundListeners=com.comphenix.protocol.injector.collection.InboundPacketListenerSet@63809b29
  outboundListeners=com.comphenix.protocol.injector.collection.OutboundPacketListenerSet@42be912b
  registeredListeners=[com.rexcantor64.triton.spigot.packetinterceptor.ProtocolLibListener@12afd31e, com.comphenix.protocol.async.NullPacketListener@2ac234d1, com.comphenix.protocol.async.NullPacketListener@2c72e6b6]
  networkManagerInjector=com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector@7605e6ba
  debug=false
  closed=false
  injected=true
]

Listeners:
com.rexcantor64.triton.spigot.packetinterceptor.ProtocolLibListener@12afd31e[
  CONTAINER_PLAYER_CLASS=class net.minecraft.world.inventory.InventoryMenu
  BASE_COMPONENT_ARRAY_CLASS=class [Lnet.md_5.bungee.api.chat.BaseComponent;
  ADVENTURE_COMPONENT_CLASS=interface net.kyori.adventure.text.Component
  PLAYER_ACTIVE_CONTAINER_FIELD=com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@1b4ab307
  PLAYER_INVENTORY_CONTAINER_FIELD=com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@7cf42a94
  SIGN_NBT_ID=minecraft:sign
  ASYNC_PASSTHROUGH=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@4af5dbe8
  advancementsPacketHandler=com.rexcantor64.triton.spigot.packetinterceptor.AdvancementsPacketHandler@139cd43a
  bossBarPacketHandler=com.rexcantor64.triton.spigot.packetinterceptor.BossBarPacketHandler@5d808fc5
  entitiesPacketHandler=com.rexcantor64.triton.spigot.packetinterceptor.EntitiesPacketHandler@fdbe6b
  signPacketHandler=com.rexcantor64.triton.spigot.packetinterceptor.SignPacketHandler@64330f07
  main=com.rexcantor64.triton.spigot.SpigotTriton@11fb2abf
  allowedTypes=[SYNC]
  packetHandlers={SCOREBOARD_OBJECTIVE[class=ClientboundSetObjectivePacket, id=104]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@253f8074, DISGUISED_CHAT[class=ClientboundDisguisedChatPacket, id=33]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@5908f8e3, ENTITY_METADATA[class=ClientboundSetEntityDataPacket, id=97]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@116e8faf, KICK_DISCONNECT[class=ClientboundDisconnectPacket, id=32]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@3a16af01, SCOREBOARD_DISPLAY_OBJECTIVE[class=ClientboundSetDisplayObjectivePacket, id=96]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@4af5dbe8, SET_ACTION_BAR_TEXT[class=ClientboundSetActionBarTextPacket, id=85]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@63f3a417, SET_SLOT[class=ClientboundContainerSetSlotPacket, id=20]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@7d22876a, WINDOW_ITEMS[class=ClientboundContainerSetContentPacket, id=18]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@18d46c96, RESET_SCORE[class=ClientboundResetScorePacket, id=77]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@4af5dbe8, ENTITY_DESTROY[class=ClientboundRemoveEntitiesPacket, id=75]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@17b5b62a, BOSS[class=ClientboundBossEventPacket, id=9]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@69986bd7, TILE_ENTITY_DATA[class=ClientboundBlockEntityDataPacket, id=6]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@e8a859, PLAYER_INFO[class=ClientboundPlayerInfoUpdatePacket, id=68]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@3b63c40e, PLAYER_INFO_REMOVE[class=ClientboundPlayerInfoRemovePacket, id=67]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@15d21ae, PLAYER_COMBAT_KILL[class=ClientboundPlayerCombatKillPacket, id=66]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@2b313481, SPAWN_ENTITY[class=ClientboundAddEntityPacket, id=1]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@6edeebde, ADVANCEMENTS[class=ClientboundUpdateAdvancementsPacket, id=128]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@4bb801bf, CHAT[class=ClientboundPlayerChatPacket, id=63]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@23001937, OPEN_WINDOW[class=ClientboundOpenScreenPacket, id=57]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@1b7b4ea, PLAYER_LIST_HEADER_FOOTER[class=ClientboundTabListPacket, id=120]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@182e2f19, OPEN_BOOK[class=ClientboundOpenBookPacket, id=56]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@1390605a, SYSTEM_CHAT[class=ClientboundSystemChatPacket, id=119]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@307a0abe, OPEN_WINDOW_MERCHANT[class=ClientboundMerchantOffersPacket, id=50]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@cd6f8bf, SET_TITLE_TEXT[class=ClientboundSetTitleTextPacket, id=112]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@65e958db, SET_SUBTITLE_TEXT[class=ClientboundSetSubtitleTextPacket, id=110]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@75eb668c, SCOREBOARD_SCORE[class=ClientboundSetScorePacket, id=108]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@4af5dbe8, MAP_CHUNK[class=ClientboundLevelChunkWithLightPacket, id=44]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@1524bd75, SCOREBOARD_TEAM[class=ClientboundSetPlayerTeamPacket, id=107]=com.rexcantor64.triton.spigot.packetinterceptor.HandlerFunction@2e0cbc6e}
  firstRun=false
  sendingWhitelist=ListeningWhitelist[priority=HIGHEST, packets=[PLAYER_INFO[class=ClientboundPlayerInfoUpdatePacket, id=68], PLAYER_INFO_REMOVE[class=ClientboundPlayerInfoRemovePacket, id=67], ENTITY_METADATA[class=ClientboundSetEntityDataPacket, id=97], SPAWN_ENTITY[class=ClientboundAddEntityPacket, id=1], KICK_DISCONNECT[class=ClientboundDisconnectPacket, id=32], ENTITY_DESTROY[class=ClientboundRemoveEntitiesPacket, id=75]], gamephase=PLAYING, options=[ASYNC]]
  receivingWhitelist=ListeningWhitelist[priority=HIGHEST, packets=[SETTINGS[class=ServerboundClientInformationPacket, id=13], CLIENT_INFORMATION[class=ServerboundClientInformationPacket, id=0]], gamephase=PLAYING, options=[ASYNC]]
]
com.comphenix.protocol.async.NullPacketListener@2ac234d1[
  sendingWhitelist=ListeningWhitelist[priority=LOW, packets=[SCOREBOARD_OBJECTIVE[class=ClientboundSetObjectivePacket, id=104], TILE_ENTITY_DATA[class=ClientboundBlockEntityDataPacket, id=6], PLAYER_COMBAT_KILL[class=ClientboundPlayerCombatKillPacket, id=66], DISGUISED_CHAT[class=ClientboundDisguisedChatPacket, id=33], SCOREBOARD_DISPLAY_OBJECTIVE[class=ClientboundSetDisplayObjectivePacket, id=96], ADVANCEMENTS[class=ClientboundUpdateAdvancementsPacket, id=128], CHAT[class=ClientboundPlayerChatPacket, id=63], OPEN_WINDOW[class=ClientboundOpenScreenPacket, id=57], PLAYER_LIST_HEADER_FOOTER[class=ClientboundTabListPacket, id=120], OPEN_BOOK[class=ClientboundOpenBookPacket, id=56], SYSTEM_CHAT[class=ClientboundSystemChatPacket, id=119], SET_ACTION_BAR_TEXT[class=ClientboundSetActionBarTextPacket, id=85], SET_SLOT[class=ClientboundContainerSetSlotPacket, id=20], WINDOW_ITEMS[class=ClientboundContainerSetContentPacket, id=18], OPEN_WINDOW_MERCHANT[class=ClientboundMerchantOffersPacket, id=50], SET_TITLE_TEXT[class=ClientboundSetTitleTextPacket, id=112], SET_SUBTITLE_TEXT[class=ClientboundSetSubtitleTextPacket, id=110], RESET_SCORE[class=ClientboundResetScorePacket, id=77], SCOREBOARD_SCORE[class=ClientboundSetScorePacket, id=108], MAP_CHUNK[class=ClientboundLevelChunkWithLightPacket, id=44], SCOREBOARD_TEAM[class=ClientboundSetPlayerTeamPacket, id=107], BOSS[class=ClientboundBossEventPacket, id=9]], gamephase=PLAYING, options=[ASYNC]]
  receivingWhitelist=ListeningWhitelist[priority=LOW, packets=[], gamephase=PLAYING, options=[ASYNC]]
  plugin=Triton v4.0.0-SNAPSHOT
]
com.comphenix.protocol.async.NullPacketListener@2c72e6b6[
  sendingWhitelist=ListeningWhitelist[priority=LOW, packets=[SERVER_INFO[class=ClientboundStatusResponsePacket, id=0]], gamephase=PLAYING, options=[ASYNC]]
  receivingWhitelist=ListeningWhitelist[priority=LOW, packets=[], gamephase=PLAYING, options=[ASYNC]]
  plugin=Triton v4.0.0-SNAPSHOT
]

Plugins Using ProtocolLib:
Triton by [Rexcantor64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions