Issues adding to a config file

Discussion in 'Plugin Development' started by paully104, May 12, 2014.

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

    paully104

    I've been reading up all day and i've tried to implement it in various fashions but i can't seem to append to my config file correctly. This is my config
    Code:
    Items-Locked:
      Location:
        x: 148
        y: 67
        z: 394
        key: AIR
    I'm simple trying to make it so that i can add multiple locations. Their names being just Location2 and so forth. The guides i've read up on suggested using a List and grabbing the "Items-Locked" and then adding to it. However once I grabbed the list and added to it there was nothing in it. Anybody have a tip for adding to a config file?

    tl:dr Goal is to add a new key [location2..3..etc and values(x,y,z,key).
     
  2. Offline

    DotDash

  3. Offline

    minoneer

    There are two ways you could go:
    1.: Implement your own Wrapper class for the Location which implements configuration serializable. Then you can just add More of them to your list, not caring about the "internal" serialization.

    2.: Do everything with Configuration sections.

    For both, you can find very good explantions and examples here: http://wiki.bukkit.org/Configuration_API_Reference
     
Thread Status:
Not open for further replies.

Share This Page