Hello, I've created a very simple resource that allows you to create Help Messages with easy: Code:java HelpMessages.addMessage("heal", "Line 1", "Line 2");//Creates a help message, so you can 'get' the string 'heal' and it will return the lines HelpMessages.get("heal");//Gets the message, in order, on separate lines. //Usefull for things like:player.sendMessage(HelpMessages.get("heal"); It is very easy to use, and its a nice way to handle messages. If you want a whole help message for a command, when ever someone uses incorrect syntax, just do sender.sendMessage(helpMessages.get("command"); and thats it! HelpMessages: Code:java package testapp; import java.util.HashMap; /**** @Author Jake*/public class HelpMessages { //HashMap for the Base and the HelpMessage associated with itprivate static HashMap<String, String[]> helpMap = new HashMap<String, String[]>(); //Add message methodpublic static void addMessage(String base, String ... message) {helpMap.put(base, message); //'puts' the base and the infinite message in the hash map} public static String get(String base) {if (helpMap.get(base) != null) { //If its in the mapString holder = ""; //Blank string for (String s: helpMap.containsKey(base)) {holder += "\n" + s;}return holder; //Returns the new string}return null; //Base is not in map, return null} } Paste version: http://pastebin.com/F497VAKy - Jake
I don't know.. this seems a little pointless when you could just do Code:java String[] message = new String[] {"Line 1", "Line 2"};player.sendMessage(message);
The_Doctor_123 Not really, since I can initialize mine, and make it multiple times, and get it multiple times. Of course you can make that static, but mine just makes it simple.
The_Doctor_123 Its not an API, its one class. And your correct, its small. Its something universally that can be used, to shorten down some code, and make it look nice in the procces.
Glad I found this was using the_doctors method actually for quite some time, this will make it much easier when documenting help for my multiple classes.