Hey i have problem
dawidox1238 opened this issue ยท 1 comments
@Generated
@Getter
@RequiredArgsConstructor
public static class PlayOutPlayerInfo implements PacketWrapper {
private final EnumSet<EnumWrappers.PlayerInfoAction> playerInfo;
private final Entity entity;
private final PacketData packetData;
private EnumWrappers.NativeGameMode gameMode;
public static @NotNull PlayOutPlayerInfo of(EnumSet<EnumWrappers.PlayerInfoAction> playerInfo, Entity entity, PacketData packetData) {
return new PlayOutPlayerInfo(playerInfo, entity, packetData);
}
@Override
public void sendPacket() {
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO);
packet.getPlayerInfoActions().writeSafely(0, EnumSet.of(playerInfo.iterator().next()));
//ERROR LINE DOWN
packet.getPlayerInfoDataLists().writeSafely(0, Collections.singletonList(
new PlayerInfoData(
new WrappedGameProfile(entity.getUniqueId(), entity.getName()),
1,
EnumWrappers.NativeGameMode.fromBukkit(
(gameMode == null ? GameMode.SURVIVAL : gameMode.toBukkit())),
WrappedChatComponent.fromText(entity.getName())
)
));
NMSPacketWrapper.sendPacket(packet, packetData);
}
}
Caused by: java.lang.ClassCastException: Cannot cast java.util.ArrayList to java.util.EnumSet
at java.base/java.lang.Class.cast(Class.java:4067) ~[?:?]
at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:41) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:361) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.writeSafely(StructureModifier.java:337) ~[?:?]
at hp.project.server.core.packets.NMSPacketWrapper$PlayOutPlayerInfo.sendPacket(NMSPacketWrapper.java:75) ~[?:?]
at hp.project.server.core.features.npc.PersonalNPC.create(PersonalNPC.java:53) ~[?:?]
at hp.project.server.core.commands.admin.TestCommand.commandExecute(TestCommand.java:22) ~[?:?]
at hp.project.server.core.commands.AbstractCommand$1.execute(AbstractCommand.java:69) ~[?:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:150) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
... 27 more
Bump, I have the same problem
Edit: This issue seems to have a solution.