I'd like to get all kinds of output. E.g. the player chats and also the broadcasted messages. I'd be looking for Event.Type.SERVER_BROADCAST // onServerBroadcast(). But there is no, so I'm looking for an approach to get those messages. Thank you in advance!
From the sounds of it you're trying to get a players chat? If so you don't need the broadcast. There is onPlayerChat(PlayerChatEvent event) which should work if you are trying to do what I think you are trying to do
A search through the javadocs shows no signs of any broadcast event. I'm not sure if custom events would work or maybe modifying the Bukkit broadcast function to also function as an event...
Hmm, that's a pity... I don't like the idea to alter the bukkit-Code :/ Hmm, no other ideas? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
The PlayerChatEvent has two variables inside, a message and formatting. I am only speculating but I would imagine the broadcast utilizes this formatting variable. If I were you I would make a PlayerChatEventListener, and every single time its triggered print the message and formatting to the console. Then say 10 things normally and 10 things as a broadcast to look for a pattern. If you have noticed all broadcast are Green and formatted like “<Broadcast>, so I would imagine its formatting variable looks like something like this: “&7<Broadcast>&0” And if so you could simply put this check inside the event: Code: If( event.getFormatting.equalsIgnoreCase(“&7<Broadcast>&0” ); { // you’ve identified a broadcast } Unfortunately I am only guessing, so it’s very possible this won’t work, but if I were taking shots in the dark this would be something I would try. I hope this helps, Good luck with your project. p.s. Ugg I had to write this twice, I accidentally closed my browser
Well, the thing is he is looking for an event for a broadcast like /say blabla from the console or Server.broadcast("Hi"). Unfortunately it doesn't fire any events. @Father Of Time I spent 5 minutes looking for proof that Server.broadcastMessage("") doesn't fire any events, and then you just remove your post <.< Anyways as you can see here, theres no events being fired. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Sorry, I removed it just for that reason, I realized afterward that I had no proof of whether it was triggered or not, and upon further research determined that it was not.