[Resolved] Configuration class problem

Discussion in 'Plugin Development' started by tee jay, Apr 24, 2011.

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

    tee jay

    I'm writing my own zoning plugin, and so far it's going well, but I can't seem to figure out why I am getting a null when trying to load certain nodes of my config. My first saving/loading attempt was to serialize the object, but I found a number of problems and holes with that so I decided to try to build in Configuration(org.bukkit.util.config.Configuration) class.

    I have Flags and States as enums for flags that can be set in a zone. These are in "zone.flags.<flagname>" nodes in my zone saves. An example of a save can be seen here:
            points: 4
                y: 165.0
                x: -63.0
                y: 167.0
                x: -68.0
                y: 159.0
                x: -73.0
                y: 158.0
                x: -64.0
            MOBS: 'ON'
            PVP: 'OFF'
            SANCTUARY: 'OFF'
            HEALING: 'OFF'
        floor: 0
        ceiling: 128
        farewell: null
        greeting: null
        name: test
        parent: everywhere
        world: world
    Now I can load every single node in here fine, except my flags. I have tried a number of things already to no avail so I m posting here now.

    Here is the piece of code that attempts to load said flags:
            // load and set the flags
            for (Flag f : Flag.values())
                System.out.println("zone.flags." + f.toString());
                String state = load.getString("zone.flags." + f.toString());
                zone.setFlag(f, State.valueOf(state));
    I print out the node it's looking for then the getString result of looking for said node:
    It is looking for a valid node(zone.flags.PVP), but getString is returning null, and I can't seem to figure out why.

    The exact line in there in my trace is
    zone.setFlag(f, State.valueOf(state));
    because state is null.

    Any suggestions?

    EDIT: Nevermind...I did something very silly in my file that took awhile to catch.
Thread Status:
Not open for further replies.

Share This Page