Configuration Section

Discussion in 'Spigot Plugin Development' started by Franchiccosd, Jan 13, 2019.

  1. I want to get the total number of worlds in the Worlds section how can i do this?

    Code (Text):
    Worlds:
      testworld1:
        Spawn:
          X: 0
          Y: 64
          Z: 0
      testworld2:
        Spawn:
          X: 0
          Y: 66
          Z: 0
     
  2. FileConfiguration#getConfigurationSection("yourSection")#getKeys(false)#size()
     
    • Agree Agree x 1
  3. I think Franchiccosd wanted the total key size. If so, "getKeys(false)" is wrong. "getKeys(true)" returns all the keys...
     
  4. If it were true, all paths (including x,y,z etc) would be included. Making the size unreasonable.
     
    • Agree Agree x 1
  5. I have do worlds.getConfiguration.getConfigurationSection("World").getKeys(false).size(); its works! Returns the 2 world's in my config
     

Share This Page