Have you ever wanted to sendMessage to a player? Of course you have! Have you ever run into having to copy/paste Code: player.sendMessage(ChatColor.Red + [Plugin] + "Bukkit is awesome!); I know I had to, until I created a messaging system! Ok first off, you must know what an enum is, if you don't please visit this then come back. Here is how I did it, and it works just fine. Code: public enum MsgType{ NORMAL(ChatColor.RED + "[BorderPatrol] " + ChatColor.GOLD), DENIED(ChatColor.RED + "[BorderPatrol] " + ChatColor.RED), ERROR(ChatColor.RED + "[BorderPatrol] " + ChatColor.BOLD), LOG("[BorderPatrol] "); private String prefix; MsgType(String prefix){ this.prefix = prefix; } @Override public String toString(){ return this.prefix; } } We're done! You now have a working messaging system! To use. Code: sendMessage(MsgType.THING + msg!)
Ultimate_n00b It is kind of that way because I personally wanted to add some more methods, but as I finished I didn't add them.
Ultimate_n00b Sorry about his guys, my little brother got on and decided to make this little project. EDIT: Updated to work, how it should
Your little brother made an enum and proceeded to post it on the bukkit forums as a resource on your account? Wow, mine usually just watches TV...
You are quite right my friend. I know I made it this way for a reason a while ago, seems like I don't need it anymore!
calebbfmv You never needed it, LOL. Anyways, I guess I'll show you my Header enum. Pretty much the same as yours, but more expalnitory. And its short. So you in the end you can type: Code:java player.sendMessage(Header.BROADCAST + "This is a broadcast"); http://pastebin.com/M7BJp8GY