How to broadcast message with Bukkit?
15,196
Remember that Bukkit.broadcastMessage(message);
records a message also on Console
. You do not actually need that in most of cases.
You can do a simple for
loop:
for (Player player : Bukkit.getOnlinePlayers()) {
player.sendMessage("It works!");
}
Or if you want you can just use
Bukkit.broadcastMessage("It works too, but for console & players!");
Author by
ThisIsEcho
Updated on June 18, 2022Comments
-
ThisIsEcho almost 2 years
In a Bukkit plugin, there's option to send message directly to player like this:
p.sendMessage(message);
Is there an option to send the message to all online players, "broadcasting" the message to everyone?
-
ThisIsEcho over 7 yearsThat's great thanks! :) i was looking for Bukkit.broadcastMessage("It works too, but for console & players"!); :P