Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] Sending a message to all current players [1.16.5]


Recommended Posts

Here is my code:

if (entity instanceof PlayerEntity) {
				Collection<NetworkPlayerInfo> users = Minecraft.getInstance().getConnection().getOnlinePlayers();
				PlayerEntity player2 = (PlayerEntity) entity;
				specificPlayer.sendMessage(new StringTextComponent(player.getDisplayName().getString() + "evaporated " + player2.getDisplayName().getString() + " using the power of the void."), player.getUUID());

I have a method of sending a message to a specific player.
And a method of grabbing all online players.


I'm not the smartest with java and I can't really figure out how to put the two together. I want to be able to send this message to all players, not just one as is currently.

If someone could give me an example and explain what they did that would be great. As I said, I'm not the greatest with java (actually a beginner (blah blah I know, shouldn't start Java off with mc modding but here I am)) but coming from other languages like Python I'm a fast learner 😏

Link to comment
Share on other sites

  • Novality changed the title to [SOLVED] Sending a message to all current players [1.16.5]

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.