Create Config

Discussion in 'Plugin Development' started by XxZHALO13Xx, Aug 29, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    XxZHALO13Xx

    How on earth do i create a config called allregions.yml... that i can access from my other class.. Because i have regions and i want to do after its created. i want to type allregions.set(myregions); myregions is the regions. so i want it to store the regions in a config file so every time server turns on it loads them. i cant figure it out.. i tried googling for the last hour and nothing i find helps :( pls help
     
  2. Offline

    fireblast709

  3. Offline

    XxZHALO13Xx

    fireblast709 right i used that but for some reason it doesnt work

    Code:java
    1. public class RegionCommand implements CommandExecutor {
    2.  
    3.  
    4. @Override
    5. public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
    6.  
    7. if (args.length == 0) {
    8.  
    9. sender.sendMessage("§c§lRegion Help.");
    10. sender.sendMessage("§8> §e/region create §3<Name>");
    11. sender.sendMessage("§8> §e/region list");
    12. sender.sendMessage("§8> §e/region delete §3<Name>");
    13. sender.sendMessage("§8> §e/region tp §3<Name>");
    14. sender.sendMessage("§8> §e/region setentry §3<Name> <Message>");
    15. sender.sendMessage("§8> §e/region setleave §3<Name> <Message>");
    16. sender.sendMessage("§8> §e/region removemessages §3<Name> <Message>");
    17. sender.sendMessage("§8> §e/region wand");
    18.  
    19.  
    20. } else {
    21. String cmd = args[0];
    22.  
    23. if (cmd.equalsIgnoreCase("create")) {
    24.  
    25. if (sender.hasPermission("regions.create")) {
    26.  
    27. if (args.length == 2) {
    28. String name = args[1];
    29.  
    30. Region rg = Regions.getRegion(name);
    31. if (rg == null) {
    32.  
    33. if (Regions.getWandStorage().containsKey(sender.getName())) {
    34.  
    35. WandPoints wand = Regions.getWandStorage().get(sender.getName());
    36. if (wand.getP1() != null && wand.getP2() != null) {
    37.  
    38. if (wand.getP1().getWorld().getName().equals(wand.getP2().getWorld().getName())) {
    39.  
    40. Region myregion = new Region(name, wand.getP1(), wand.getP2(), sender.getName());
    41. Regions.getRegions().add(myregion);
    42. sender.sendMessage(ChatColor.GREEN + "Region Created.");
    43.  
    44. // Want to add to config here.. what do i do
    45.  
    46.  
    47.  
     
  4. Offline

    Gnat008

    XxZHALO13Xx
    You'll want to take a look at this section from the link posted above.
     
  5. Offline

    XxZHALO13Xx

  6. Offline

    TheHandfish

    I love the irony in your signature, lol.
     
Thread Status:
Not open for further replies.

Share This Page