Custom Config returns 0

Discussion in 'Plugin Development' started by bobnixon1, May 28, 2014.

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

    bobnixon1

    So.... I have this custom config file (from the wiki) and I am trying to get a int but it just returns 0. I am not sure why and I checked the values and the values are different from what I am getting.
    Code:
    int cX = Casino.casinoConfig.getBlockConfig().getInt(b.getX() + ":" + b.getY() + ":" + b.getZ() + ":" + ".controllerX"); // this returns 0
    This is in the main class so other classes can access the config:
    Code:
    public static CasinoConfig casinoConfig = new CasinoConfig();
     
  2. Offline

    rsod

    Are you sure that requested line exists in the configuration file?
     
  3. Offline

    metalhedd

    don't use ':' (or .) in your key names
     
  4. Offline

    mythbusterma

    There's nothing wrong with using periods in the name, it merely indicates a child node, like all yaml. As for your question, don't use colons and it is very likely you did not set up your config correctly from the looks of it.
     
  5. Offline

    metalhedd

    There is absolutely something wrong with using a . in the name of a config key... You can't do it, and if you write a yaml file manually like that you'll never be able to be read it back. Its invalid, plain and simple. You can USE a . in most of the FileConfiguration methods, but they don't actually Create keys with .'s, they split on the .'s and create child nodes. Like you already pointed out. This is not what this person wants.
     
  6. Offline

    bobnixon1

    metalhedd Thanks, trying that right now.. and I see why not to use periods and colons, I am kicking myself for using those.
     
Thread Status:
Not open for further replies.

Share This Page