ProtocolLib

3M Downloads

BLOCK_BREAK_ANIMATION listener does not work

ignissak opened this issue ยท 2 comments

commented

Describe the question
Listening to Play.Server.BLOCK_BREAK_ANIMATION does nothing. This listener is never called.

Code

protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_BREAK_ANIMATION) {

            @Override
            public void onPacketReceiving(PacketEvent event) {
                System.out.println(event.getPacket());
            }

            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                Player player = event.getPlayer();

                System.out.println(packet);

                if (packet.getType() != PacketType.Play.Server.BLOCK_BREAK_ANIMATION) return;

                BlockPosition blockPosition = packet.getBlockPositionModifier().read(0);
                Byte stage = packet.getBytes().read(0);
                Integer entityID = packet.getIntegers().read(0);

                Bukkit.broadcastMessage("position: " + blockPosition.getX() + " " + blockPosition.getY() + " " + blockPosition.getZ() + ", stage: " + stage + ", entityID: " + entityID);
            }
        });

Expected behavior
I expected it to debug something into console, but nothing is printed after breaking a block.

commented

Hey igni, i'm having the same issue, did you figure out?

commented

listener still does not work for me