[ERROR] Protocollib won´t work with Paper !! Serverbound - Unknown packages
nanana90 opened this issue · 1 comments
• 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
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