Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.3-pre2 client crash when sending a scoreboard packet #3565

Closed
3 of 4 tasks
NEZNAMY opened this issue Nov 25, 2023 · 9 comments
Closed
3 of 4 tasks

1.20.3-pre2 client crash when sending a scoreboard packet #3565

NEZNAMY opened this issue Nov 25, 2023 · 9 comments

Comments

@NEZNAMY
Copy link

NEZNAMY commented Nov 25, 2023

Bungeecord version

Build 1773

Server version

Vanilla 1.20.3-pre2

Client version

1.20.3-pre2

Bungeecord plugins

A plugin to reproduce this

The bug

Compiling and running the following code crashes the client:

    @EventHandler
    public void onSwitch(ServerSwitchEvent e) {
        ((UserConnection)e.getPlayer()).sendPacketQueued(new ScoreboardObjective(
                "Test",
                Either.right(new TextComponent("Hello")),
                ScoreboardObjective.HealthDisplay.INTEGER,
                (byte) 0,
                null
        ));
    }

While I know this is not the official API, there isn't one for scoreboards despite the API having a few useless scoreboard classes. I am even using sendPacketQueued to make sure this will not be sent during configuration phase, but still no success. Running this code on backend (tested on Fabric) works correctly.
Running this code with a delay high enough for the client to actually load into the world solves it. The problem is that this "delay" time is not fixed and therefore not reliable. Is there any better way to check if player is loaded into the world?

Log output (links)

Crash log:

java.lang.NullPointerException: Cannot invoke "fnr.K()" because "this.o" is null
	at fns.a(SourceFile:1916)
	at aci.a(SourceFile:63)
	at aci.a(SourceFile:14)
	at xh.a(SourceFile:23)
	at biq.d(SourceFile:156)
	at biu.d(SourceFile:23)
	at biq.x(SourceFile:130)
	at biq.bu(SourceFile:115)
	at evh.d(SourceFile:1279)
	at evh.f(SourceFile:884)
	at net.minecraft.client.main.Main.main(SourceFile:265)

Deobfuscated version using official mojang mappings:

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.multiplayer.ClientLevel.scoreboard()" because "this.level" is null
	at net.minecraft.client.multiplayer.ClientPacketListener.handleAddObjective(SourceFile:1916)
	at net.minecraft.network.protocol.game.ClientboundSetObjectivePacket.handle(SourceFile:63)
	at net.minecraft.network.protocol.game.ClientboundSetObjectivePacket.handle(SourceFile:14)
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(SourceFile:23)
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(SourceFile:156)
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(SourceFile:23)
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(SourceFile:130)
	at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(SourceFile:115)
	at net.minecraft.client.Minecraft.runTick(SourceFile:1279)
	at net.minecraft.client.Minecraft.run(SourceFile:884)
	at net.minecraft.client.main.Main.main(SourceFile:265)

Checking

  • I am using BungeeCord and not a fork. Issues with forks should not be reported here.
  • I think this is not an issue with a bungeecord plugin.
  • I have not read these checkboxes and therefore I just ticked them all.
  • This is not a question or plugin creation help request.
@md-5
Copy link
Member

md-5 commented Nov 25, 2023

What exactly is the bug in bungee? This seems like a request for help understanding the client side operation of scoreboards which isn't relevant to the operation of bungee

@md-5
Copy link
Member

md-5 commented Nov 25, 2023

This just looks like a duplicate of #3542

@md-5 md-5 closed this as completed Nov 25, 2023
@NEZNAMY
Copy link
Author

NEZNAMY commented Nov 25, 2023

Assuming bungeecord does work as expected, how do I check if player is loaded into the world using BungeeCord API? Because right now it's a coinflip whether my packet will go through or crash the client.

Also, should I open a separate issue for 197bf13#r133469222?

This is not a duplicate of that issue, I tried sending this packet after login packet is sent even with a 500ms delay, but it still crashes.

@md-5
Copy link
Member

md-5 commented Nov 25, 2023

This is not a duplicate of that issue, I tried sending this packet after login packet is sent even with a 500ms delay, but it still crashes.

The vanilla server sends it after the login packet just fine. Packets aren't Bungee API so a bug with packets isn't going to be accepted as a bug report unless it's clear what the Bungee aspect of the issue is. It is very easy to send the wrong packets at the wrong time and cause all sorts of client issues without it being a Bungee bug.

@NEZNAMY
Copy link
Author

NEZNAMY commented Nov 25, 2023

I should probably note that this works perfectly fine for a 1.20.2 client. I can test anything you can think could help, for example the login packet thing - I am listening to packets and only sending scoreboard packets with a 500ms delay after login packet is sent, but I still get the crash.

@md-5
Copy link
Member

md-5 commented Nov 25, 2023

I would suggest double checking that logic, because Vanilla seems to work fine.

Otherwise, when playing with packets you're debugging on your own - that's the difference between packets and API

@NEZNAMY
Copy link
Author

NEZNAMY commented Nov 25, 2023

The problem is that BungeeCord is lacking API for tons of things, so I am forced to use packets. I would obviously much rather use an API, but I can't if it doesn't exist and the API that does exist is throwing errors.

@Janmm14
Copy link
Contributor

Janmm14 commented Nov 26, 2023

I think bungee maybe has too much API. Let bungee be a simple, performant proxy and handle everything else on spigot.

@NEZNAMY
Copy link
Author

NEZNAMY commented Nov 26, 2023

Then how would you for example show all players connected to the entire proxy in tablist using the plugin only on bukkit? You'd need some soft of communication between servers, for example plugin messages with the plugin message "server" on the proxy, which opens up more room for potential bugs, not to mention that the ultimate bukkit API doesn't even offer adding entries to the tablist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants