Help with Looping though the config?

Discussion in 'Plugin Development' started by timlacafe, Jul 25, 2014.

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

    timlacafe

    Hello i am using bukkit 1.7.2, my plugin hase it when the player types a command it set the location of the block and the name of what they named the block(the command is like this /setblock <groupname> <blockname>) in the config so later the plugin can acccess the config and find out where the block is. What i am doing is checking when the player moves if the block around them is the block in the config, but i am having troubles because i do not know how many blocks the user will add and what names they will add to the block location here is an exaple of what the config may look like:

    Code:
    WorldName:
     
      groupname:
     
        block1:
     
          x: 127
     
          y: 30
     
          z: 542
     
        block2:
     
          x: 608
     
          y: -50
     
          z: 430
     
      groupname2:
     
        test10:
     
          x: 1000
     
          y: 36
     
          z: 324
     
        test20:
     
          x: 890
     
          y: 32
     
          z: 30
    in general what i am trying to do is access the config an loop though all the diferent block names and get their position and compare it to where the player is, how can i do this? please let me know if this does not make sense. Thank you for any help.
     
  2. Offline

    Totom3

    timlacafe You can get all the values of a ConfigurationSection with getValues(false). To get the ConfigurationSection, you do config.getConfigurationSection(path);
     
Thread Status:
Not open for further replies.

Share This Page