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

ProtocolLib may cause breaking packet reordering #3327

Open
1 task done
MrEAlderson opened this issue Dec 18, 2024 · 2 comments
Open
1 task done

ProtocolLib may cause breaking packet reordering #3327

MrEAlderson opened this issue Dec 18, 2024 · 2 comments

Comments

@MrEAlderson
Copy link

MrEAlderson commented Dec 18, 2024

  • This issue is not solved in a development build

Describe the bug
Spawning a player relies on its player info being sent before its spawn packet. If the client is told to spawn a player with missing player info, it won't spawn it at all. As a consequence and in case a listener for the PlayerInfo packet is added to ProtocolLib, the NPC will not spawn at all:

      ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(MBedwars.plugin, Server.PLAYER_INFO) {
        @Override
        public void onPacketSending(PacketEvent event) {
          
        }
      });

On the hand if listening to both packets, the NPC will spawn just fine:

      ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(MBedwars.plugin, Server.PLAYER_INFO, Server.NAMED_ENTITY_SPAWN) {
        @Override
        public void onPacketSending(PacketEvent event) {
          
        }
      });

To Reproduce
Steps to reproduce the behavior:
Have a plugin that spawns NPCs using packets with no delay between its PlayerInfo and NamedEntitySpawn packet. Add a listener to ProtocolLib for only the PlayerInfo packet.

Version Info
https://pastebin.com/wJMZtrz1

Potentially related to #2948

@Jpx3
Copy link
Contributor

Jpx3 commented Dec 20, 2024

Add ListenerOptions.ASYNC to adapter

@MrEAlderson
Copy link
Author

Add ListenerOptions.ASYNC to adapter

You want me to locate and fix every plugin existing that is listening wrongfully to that packet?

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

2 participants