Getting size of list in file

Discussion in 'Plugin Development' started by HamOmlet, Aug 29, 2012.

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

    HamOmlet

    I'm attempting to get the size of "id" in the below configuration:
    Code:
    id:
      '0':
        item: 251,3
        cost: 50
      '1':
        item: 351,4
        cost: 35
      '2':
        item: 128,2
        cost: 10
      '3':
        item: 189,1
        cost: 12
    Would I use something like getList("id").size() or getIntegerList("id").size()?

    The above example should return a size of four.
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    What you have is a map in yaml.
    The following is a syntax for a lsit
    Code:
    ids:
      - 1
      - 2
      - 3
      - 4
     
  3. Offline

    HamOmlet

    Ah, so I'm looking got MapList instead.
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    a list of maps has the following syntax
    Code:
    ids:
      - item: 8
        cost: 1
      - item: 3
        cost: 2
      - item: 2
        cost: 4
     
Thread Status:
Not open for further replies.

Share This Page