WiIIiam278/Velocitab

Client throws network protocol error when joining team

MATRIX-feather opened this issue · 2 comments

Description

Once you join a team on the backend server, the client will disconnect with "Network Protocol Error".

This only happens on 1.20.6.

  • Plugin version: 1.6.5-1f54cf7
  • Backend server: Paper 1.20.6-130-master@5d8e53d

Logs

Related log on client, where player is the team joined on the backend:


[18:17:01] [Render thread/ERROR] (Minecraft) Failed to handle packet net.minecraft.class_5900@29f0a10c
java.lang.IllegalStateException: Player is either on another team or not on any team. Cannot remove from team 'player'.
	at MC/net.minecraft.scoreboard.Scoreboard.removePlayerFromTeam(Scoreboard.java:308) ~[client-intermediary.jar:?]
	at MC/net.minecraft.client.network.ClientPlayNetworkHandler.onTeamUpdate(ClientPlayNetworkHandler.java:2044) ~[client-intermediary.jar:?]
	at MC/net.minecraft.network.packet.s2c.play.TeamUpdateS2CPacket.apply(TeamUpdateS2CPacket.java:132) ~[client-intermediary.jar:?]
	at MC/net.minecraft.network.packet.s2c.play.TeamUpdateS2CPacket.apply(TeamUpdateS2CPacket.java:18) ~[client-intermediary.jar:?]
	at MC/net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:25) ~[client-intermediary.jar:?]
	at MC/net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:162) [client-intermediary.jar:?]
	at MC/net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) [client-intermediary.jar:?]
	at MC/net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:136) [client-intermediary.jar:?]
	at MC/net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:121) [client-intermediary.jar:?]
	at MC/net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1275) [client-intermediary.jar:?]
	at MC/net.minecraft.client.MinecraftClient.run(MinecraftClient.java:888) [client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:265) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) [fabric-loader-0.15.11.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.15.11.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.15.11.jar:?]

Once you join a team on the backend server

Minecraft introduced more strict backend sanity checking in 1.20.6 (I believe there is a backend flag you can pass to bypass it temporarily). The result is that stuff done on the proxy that conflicts with the backend now disconnects the player.

Since Velocitab relies on joining scoreboard teams to sort players in TAB, and the general assumption is that most users are running plugins or mods on their backend that don't require that, this can occur when the backend joins a team that Velocity doesn't know about. Velocitab therefore joins players on "fake" teams that only it and clients know about, causing clients to freak out when the backend updates team stuff that the client doesn't know about.

The fix is to:

  • Not use stuff on your backend server that uses teams
  • Disable send_scoreboard_packets in Velocitab's config.yml (players will no longer be sorted in TAB).
# Whether to send scoreboard teams packets. Required for player list sorting and nametag formatting.
# Turn this off if you're using scoreboard teams on backend servers.
send_scoreboard_packets: true

Got it, thanks!