Again: the new config system

Discussion in 'Plugin Development' started by Terra-Network.org, Nov 26, 2011.

Thread Status:
Not open for further replies.
  1. Hi guys,

    several hours ago i started converting an inactive plugin to work with the latest RB.
    There wasn't much to do, because the only problem was the new way bukkit is working with config files.
    I tried the new version and i can read most hings, but with one thing i'm still having problems:


    Code:
    double joinCost = settings.getDouble(player.getWorld().getName() + ".professions." + args[1] + ".join-cost", 0.0);
     economy.withdrawPlayer((player.getName()), joinCost);
    That's what the config looks like:

    Code:
    world:
      professions:
        faction:
          limit: 1
          time: 192
          join-cost: 200
          leave-cost: 600
    And that's how i integrate the config file:

    Code:
    sFile = new File(getDataFolder().getPath()+"/settings.yml");
    settings = YamlConfiguration.loadConfiguration(sFile);
    When i try to read the join-cost it always returns the default: 0.0
    How can i solve it?

    Thanks!
     
  2. Offline

    Don Redhorse

    you have an INT... a double needs 100.00

    iirc
     
  3. Oh yeah, didn't even look at that part of the code ...
    Automatic type conversion was removed in the new config (rage!), now everything has to be exactly the same strict type, or get{Type} methods will return null ...

    Please take a look at your file creating stuff anyway, even though it might work, it isn't pretty and a bad manner (Windows has '\' as a dir separator, and there is a special File constructor to use for sub-dirs for example).
     
Thread Status:
Not open for further replies.

Share This Page