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

[ERROR] Protocollib won´t work with Paper !! Serverbound - Unknown packages #3344

Open
nanana90 opened this issue Jan 5, 2025 · 2 comments

Comments

@nanana90
Copy link

nanana90 commented Jan 5, 2025

• This issue is not solved in a development build

Describe the bug

• When joining the server, an error occurs, and it is not possible to connect. The console logs indicate an issue with encoding a specific packet (clientbound/minecraft:set_objective).

To Reproduce
Steps to reproduce the behavior:

Start the server with ProtocolLib installed.
Attempt to join the server.
Observe the console log and notice the error.
Expected behavior
Players and owners should be able to join the server without errors, and the connection process should complete successfully.

Screenshots
If applicable, add screenshots to help explain your problem.

https://pasteboard.co/RCvF3wATm3dD.png

Version Info
ProtocolLib version: 5.3.0
Server version: Paper 1.21.1 (Build 81, commit 13a2395)
Please find the full ProtocolLib dump here: (https://pastebin.com/91kxBRCR).

Additional context

@UnknownRebell
Copy link

UnknownRebell commented Jan 5, 2025

Hello, i have got the same error by using this in my plugin.

import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
//import com.comphenix.protocol.wrappers.WrappedDataWatcherObject;
^ Dosnt exist, i tought it got moved to com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
import com.comphenix.protocol.PacketType;
import org.bukkit.Location;
import org.bukkit.entity.Player;

import java.util.UUID;

public class test {
    public void sendInvisibleArmorStand(Player player, Location location, String text) {
        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();

        try {
            PacketContainer spawnPacket = protocolManager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
            int entityId = (int) (Math.random() * Integer.MAX_VALUE);
            spawnPacket.getIntegers().write(0, entityId); // Entity ID
            spawnPacket.getUUIDs().write(0, UUID.randomUUID()); // Unique ID
            spawnPacket.getEntityTypeModifier().write(0, org.bukkit.entity.EntityType.ARMOR_STAND); // ArmorStand Type
            spawnPacket.getDoubles().write(0, location.getX()).write(1, location.getY()).write(2, location.getZ()); // Position

            PacketContainer metadataPacket = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
            metadataPacket.getIntegers().write(0, entityId); // Entity ID

            //The Problem I guess:
            WrappedDataWatcher watcher = new WrappedDataWatcher();
            watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, Registry.get(Byte.class)), (byte) 0x20); // Invisible
            watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, Registry.getChatComponentSerializer(true)), WrappedChatComponent.fromText(text)); // Custom Name
            watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, Registry.get(Boolean.class)), true); // Custom Name Visible

            metadataPacket.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());

            protocolManager.sendServerPacket(player, spawnPacket);
            protocolManager.sendServerPacket(player, metadataPacket);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Server Side Log: https://pastebin.com/NJCEWNMU
Player gets kicked as seen.

The difference for me is that the player only gets kicked when i run this method.

Im Using ProtocolLib 5.4.0-SNAPSHOT-739

Servers Tried:
Paper 1.21.4 (Dev Release)
Spigot 1.21.4

@nanana90 nanana90 changed the title Serverbound - Unknown packages [ERROR] Protocollib won´t work with Paper !! Serverbound - Unknown packages Jan 10, 2025
@spring-dependency-management

You can use the protocollib jar as an API as a workaround

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