Jump to content

Broadcasting A Chat Message To All Players On The Server


Recommended Posts

Posted

Yello,

 

Quick question, just looking to see if there is a better way of doing this:

 

List<EntityPlayerMP> players = ModLoader.getMinecraftServerInstance().worldServers[0].playerEntities;
for (int t = 0; t < players.size(); t++)
{
players.get(t).sendChatToPlayer("All player statistics have been reset.");
}

 

That code fragment is from a server command I've added that keeps track server and player uptime and death statistics, that comes from a sub command that resets the player side of the statistics. Basically I couldn't find if there was a simple command that would broadcast to all players or if what I've got up there is a reasonable way of doing it.

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.