Im looking to make a ChatManager. I have acouple of questions: What would be the best way to change what the message looks like? (IE, changing the < before name, etc)? Would it be cancelling the event and broadcasting it? What does add reciptient and remove do? Thanks!
Use a modify format thing and put it in your config.yml, then you can edit the chat so it looks however you like.
Last time I checked you cant cancel. And doing broadcast would be bad because you wouldn't mute people. In the bukkit javadocs there is a very good example of formatting chat.
I'm fairly certain you can cancel the chat event. How would plugins that stop you from chatting do stuff like that?
They way I do chat stuff is do event.setFormat and the first occurance of %s is the player's name (who chatted) and the second occurance of %s is the message. Recepients is the players that receive the message.
mattrick16 JPG2000 You can cancel the AsyncPlayerChatEvent, as for setting the format and stuff use Code: event.setFormat(ChatColor.RED + "Admin " + ChatColor.GREEN + player.getName() + ChatColor.WHITE + event.getMessage()) If you want to be able to set custom prefixes/suffix just get the sting from the config.yml and add it to the format function.
MCCoding Thank you. I know java, I just didn't know there was a setFormat method, or what I did. Thanks.