Jump to content

[1.8] Best way to send packets to specified amount of people


Jedispencer21

Recommended Posts

Basically what I am doing is that, I has some waypoints in which you can share with other people, the only thing is, is that if the person who shared the waypoint updates that waypoint, it will not change for anyone else who they have shared the waypoint with. So what I am wondering is what would be the best way to send an updated waypoint packet to everyone else who the waypoint is shared with.

Link to comment
Share on other sites

have a list of all players that are receiving the waypoint and

for(string pName : list)

if(!pName.equals(editingplayer.name)

  sendmessage(msg, world.getplayer(pname);

 

can't be copy pasted but you can use that structure to updated everyone you need to.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Link to comment
Share on other sites

Since I send the update message from the actual packet what would be the best thing to go with to send to players, a String array or a List of Strings since I am storing the name of players the waypoint has been shared with, also how would I send their data through the packet since I know you can send strings, but not string arrays or lists.

Link to comment
Share on other sites

the way my waypoints work is that there is two types of waypoints, just a normal "Waypoint", and then there is the "Shared Waypoint", the waypoint is what is created when a user creates a new waypoint, a shared waypoint is what a user receives from other users. The waypoint is editable, but the shared waypoint is not editable, meaning that only the user that shared the waypoint can edit it, and the users who have received that waypoint should get the edited version once the creator of the waypoint clicks the confirm edit button. I have up to the point so that it can send the update to a specified player, but I cannot figure out how to send it to all the players that are stored in a List of Strings (it is strings because it stores their usernames). I have the usernames stored in the list instead of an array since to add a new name to an array I would have to create a new array, but instead I can just add it to a list.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.