Help with packet please
Olzie-12 opened this issue ยท 0 comments
Make sure you're doing the following
- You're using the latest build for your server version Yes
- This isn't an issue caused by another plugin Yes
- You've checked for duplicate issues Yes
- You didn't use
/reload
Yes
Describe the question
I'm trying to add fake players to the tablist, but they're getting the wrong skin. (Steve skins)
API method(s) used
packetContainer = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
packetContainer.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
List<PlayerInfoData> pd = new ArrayList<>();
WrappedSignedProperty signedProperty = WrappedSignedProperty.fromValues("texture", Configuration.getConfig().getString("default-texture"), null);
for (String s : Configuration.getConfig().getStringList("tab-completions")) {
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.randomUUID(), s);
gameProfile.getProperties().put("textures", signedProperty);
pd.add(new PlayerInfoData(gameProfile, 0, EnumWrappers.NativeGameMode.SPECTATOR, WrappedChatComponent.fromText("")));
}
packetContainer.getPlayerInfoDataLists().write(0, pd);
}
@EventHandler
public void onTest(PlayerJoinEvent event) {
Bukkit.getScheduler().runTaskLater(plugin, () -> {
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packetContainer);
} catch (InvocationTargetException ex) {
ex.printStackTrace();
}
}, 1L);
}
Expected behavior
The skin is meant to appear as "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWRkZWJiYjA2MmY2YTM4NWE5MWNhMDVmMThmNWMwYWNiZTMzZTJkMDZlZTllNzQxNmNlZjZlZTQzZGZlMmZiIn19fQ==", but its appearing as a steve skin. Any help is appreciated.
Code
I sent the code above