You just recreated the same topic for the same problem that I believe should be fixed.
Packet class
1 2 3
| public class PlayerPacket(){ public ArrayList<Player> otherPlayers; } |
How your going to be sending the packet from the server to the client? im guessing?
1 2 3 4 5 6
| PlayerPacket packet = new PlayerPacket();
packet.otherPlayers = players;
server.sendToAllTCP(packet); |
You could of posted in your old topic, did not work, or better explanation instead of creating a whole new topic for the same question by the same person.
This is how I send packets through my server. the PlayerPacket should be pretty much the only code needed in the class.
edit: commented one line of code.
edit 2:
The only problem I had with ArrayLists for entities to be sent the size that is being sent can easily be to big, Im not sure if their is away to allow for bigger packet sizes.