essentially, the idea for this plugin is to make it to where you type ./serverinfo it will print everything thats placed under serverinfo: in the yml. so instead of having to add more code for each and every line under that i wanted to make it to where annybody using the plugin can add custom lines. =================================================== example config: =================================================== http://pastie.org/4198426 =================================================== i want it to load all this stuff without requiring modification to the plugins code. now for some reason, the plugin when i enter the command sends me no errors, gives no errors in the server prompt, and no errors in essentials. here is the coding for my plugin. =================================================== http://pastie.org/4198413 - changed to a pastie link. (indents didn't work in this) ================================================================= so if anyone has any idea why this isn't working it would be appreciated.
Most likely, you will get a NPE. Code:java for (String serverinfo : getConfig().getStringList("serverinfo")){Player player = (Player) sender;sender.sendMessage(serverinfo);return true;} I will recommend that you create a config like this : Code: serverinfo: - server: TystoCraft - owner: Tystom3 - host: Tystom3 - admins: JMarkus - creeper: TNTUP In which serverinfo is a List and the strings on the lists are in the format blahblah:value Then when you are getting the values do this : Code:java List<String> serverinfo = getConfig().getStringList("serverinfo");try{for (String string : serverinfo) {player.sendMessage(string);}}catch (Exception x) {//error}return true;
You could create a list like this: Code: serverinfo: - Server-TystoCraft - Owner-Tystom3 - Host-Tystom3 and then read string list and split like this: Code: List<String> items = this.plugin.getConfig().getStringList("serverinfo"); for (String s : items) { String temp[] = s.split("-"); player.sendMessage(temp[0] + ": " + temp[1]); } this will split the string in 2: using the server name: temp[0] will contain the server title (Server) and temp [1] will contain the the server name (TystoCraft). this will repeat for everything in the list printing it in the chat for the player