ProtocolLib

3M Downloads

ProtocolLib may cause breaking packet reordering

MrEAlderson opened this issue ยท 2 comments

commented
  • 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

commented

Add ListenerOptions.ASYNC to adapter

commented

Add ListenerOptions.ASYNC to adapter

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