(Deprecated) Bukkit's Standard Configuration Tutorial

Discussion in 'Resources' started by captainawesome7, Jul 11, 2011.

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

    Perdog

    Okay that's what I was thinking because saw some of the same things in the second method. Thank you :)
     
  2. Offline

    jzsig

    Could you please tell me how you fixed this?
     
  3. Offline

    captainawesome7

    You use ' instead of "
     
  4. Offline

    jzsig

    im sorry im a noob, but where do i put this exactly?
     
  5. Offline

    BugSpreadeR

    how to make the config look like this
    Code:
    Users:
        <name>=<something>
    enablePlugin=true
     
  6. Offline

    Dazzel

    You must follow the instructions in the opening post first ;)

    Code:
    config.getString("Users.name", "something");
    config.getBoolean("enablePlugin", true);
     
  7. i get this yet i have no spaces?
     
    woutwoot likes this.
  8. Offline

    woutwoot

    Same problem here ...
    Have you found a solution ?
     
  9. Offline

    captainawesome7

    If you're having problems in the config, its 100% your fault.
    It might be a problem with your config as far as the path system goes. For instance, you can't have values like this:
    Code:
    Player: captainawesome7
        DisplayName: TheCaptainOfAwesome
        IsAwesome: true
     
  10. Offline

    stelar7

    @captainawesome7
    Can you help me a bit ?

    After i create the config, stop and start the server again, i cant use any of the stuff created with the config, so i have to remake it...
     
  11. Offline

    SpikeMeister

    This is a great tutorial! Why not put it on the wiki? People shouldn't have to go hunting around all over the forums for useful info like this!
     
  12. The Problem with that statement there is that as people said they followed your tutorial to the letter and they still got an error then its probably your fault for giving misinformation

    and on the point of the error it seems that it is the colons in the configuration which is probably something that the bukkit team (thanks for the hard work guys) should have a look at and maybe look for a better more stable solution
     
  13. Offline

    captainawesome7

    No. If you have a configuration set up like:
    Code:
    String derp = config.getString("Derp");
    String fail = config.getString("Derp.Fail");
    It will give you an error because mapping values aren't allowed after the key has already been used.
     
  14. Code:text
    1.  
    2. maxTime = config.getInt("maximaltime", 0);
    3. hcChannelName = config.getString("herochatchannelname", "global");
    4. hcEnabled = config.getBoolean("enableherochat", false);
    5. circEnabled = config.getBoolean("enablecraftirc", false);
    6. circTag = config.getString("craftirctag", "all");
    7.  
    8. if (hcEnabled) {
    9. enableHeroChat();
    10. }
    11. if (circEnabled)
    12.  
    13. {
    14. enableCraftIRC();
    15. }
    16. String perm = config.getString("permissionplugin", "permissions");
    17. if (perm.equalsIgnoreCase("permissions"))
    18. ph.enablePermissions();
    19. else if (perm.equalsIgnoreCase("groupmanager"))
    20. ph.enableGroupManager();
    21. else
    22. System.out
    23. .println("[iAuction] WARNING! No permission system enabled!");
    24. tagColor = ChatColor.valueOf(
    25. config.getString("tagcolor", "yellow").toUpperCase())
    26. .toString();
    27. warningColor = ChatColor.valueOf(
    28. config.getString("warningcolor", "red").toUpperCase())
    29. .toString();
    30. auctionStatusColor = ChatColor.valueOf(
    31. config.getString("auctionstatuscolor", "dark_green")
    32. .toUpperCase()).toString();
    33. auctionTimeColor = ChatColor.valueOf(
    34. config.getString("auctiontimecolor", "dark_aqua")
    35. .toUpperCase()).toString();
    36. helpMainColor = ChatColor.valueOf(
    37. config.getString("helpmaincolor", "yellow").toUpperCase())
    38. .toString();
    39. helpCommandColor = ChatColor.valueOf(
    40. config.getString("helpcommandcolor", "aqua").toUpperCase())
    41. .toString();
    42. helpOrColor = ChatColor.valueOf(
    43. config.getString("helporcolor", "blue").toUpperCase())
    44. .toString();
    45. helpObligatoryColor = ChatColor.valueOf(
    46. config.getString("helpobligatorcolor", "dark_red")
    47. .toUpperCase()).toString();
    48. helpOptionalColor = ChatColor.valueOf(
    49. config.getString("helpoptionalcolor", "light_purple")
    50. .toUpperCase()).toString();
    51. infoPrimaryColor = ChatColor.valueOf(
    52. config.getString("infoprimarycolor", "blue").toUpperCase())
    53. .toString();
    54. infoSecondaryColor = ChatColor.valueOf(
    55. config.getString("infosecondarycolor", "aqua")
    56. .toUpperCase()).toString();
    57. tag = (new StringBuilder(String.valueOf(tagColor)))
    58. .append("[AUCTION] ").toString();
    59. anti = config.getBoolean("enableantisnipe", false);
    60. antiint = config.getInt("antisnipevalue", 5);
    61. config.save();
    62.  


    It's spot the error Time!
     
  15. Offline

    captainawesome7

    @rob4001 what?
    *Edit*
    maximaltime should be maximumtime
    not an error, just saying
     
  16. But whats wrong with that code as i get a yml parsing error
     
  17. Offline

    captainawesome7

    Does it make a config file?
     
  18. Offline

    captainawesome7

    Can you paste the config inside of a code block so I can see it?
     
  19. Offline

    KingAtomx

    Hey I followed your instructions, Thanks Loads :D
    but whenever I reload the server it goes back to default configuration.
    I'm a noob at making plugins (I started a few days ago) and the error is probably really obvious.
    I don't want to bother you but can you help?
    Here is the code:
    Code:
        public void onEnable(){
            config = getConfiguration();
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.Normal, this);
            pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Event.Priority.Normal, this);
            PluginDescriptionFile pdfFile = this.getDescription();
            this.log.info(pdfFile.getName() + " Version: " + pdfFile.getVersion() + " is Enabled")
            config = getConfiguration();
            healthblock = config.getInt("HealingBlock", 41);
            setspawnblock = config.getInt("SetSpawnBlock", 19);
            spawnblock = config.getInt("TeleSpawnBlock", 57);
            config.save();
            config.load();
            this.log.info(pdfFile.getFullName() + " configuration loaded");
        }
    
        // onDisable
    
        public void onDisable(){
            this.log.info(pdfFile.getName() + " Version: " + pdfFile.getVersion() + " is Disabled");
            config.save();
        }
    Thanks Loads,
    KingAtomx
     
  20. Offline

    captainawesome7

    @KingAtomx you're supposed to load it before you save it... like:
    Code:
    config = getConfiguration();
    config.load();
    String asdf = config.getString("STRING", "asdf");
    config.save();
     
  21. Offline

    KingAtomx

    Thanks, working now.
    Seems I also had to remove config.save(); from onDisable()
    Thanks for your time :D
     
  22. Offline

    SpikeMeister

  23. Offline

    captainawesome7

    Cool, I was going to do it myself but I feared that it "wouldn't be well received" from Adamki11s.
     
  24. I dont have the config i canged the way i did it
     
  25. Offline

    Butkicker12

    @captainawesome7 So I start my server up it creates a folder and config.yml with no errors. I restart it without editting the file and get this error
    Code
    Hope you can help:)
     
  26. Offline

    captainawesome7

    You're going to need to post the config code as well.
     
  27. Offline

    Butkicker12

    Code:
    FAQToolbox
    faq: This is the default text!
    faq2: This is default text for line three!
    faq1: This is default text for line two!
    
     
  28. Offline

    Sagacious_Zed Bukkit Docs

    You need to put the comment sign in front of the header string when you call setHeader
    Code:java
    1. config.setHeader("# FAqToolbox");
     
    Butkicker12 likes this.
  29. Offline

    Butkicker12

    Thanks that worked :) And you spotted a typo
     
Thread Status:
Not open for further replies.

Share This Page