Chunks... And Yaml

Discussion in 'Plugin Development' started by Sahee, Apr 6, 2013.

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

    Sahee

    hello! I have an question, im stuck.
    I have list witch chunks:
    http://pastebin.com/n3477P8f

    And how i can get how mutch chunks Owning_Kingdom : arror

    Any ideas? :p
     
  2. Offline

    JazzaG

    Code:
    /**
     * Gets all chunks belonging to kingdom from config
     * @param kingdom Kingdom name to search ownership
     * @return Set of chunks belonging to kingdom
     */
    Set<String> getChunksByKingdom(String kingdom) {
        Set<String> list = new HashSet<String>();
        for(Object key : getConfig().getConfigurationSection("chunks").getKeys(false).toArray()) {
            String chunk = key.toString();
            if(getConfig().getString("chunks." + chunk + ".owning_kingdom").equalsIgnoreCase(kingdom))
                list.add(chunk);
        }
     
        return list;
    }
     
    Set<String> arrows = getChunksByKingdom("arrow");
     
    
     
    Sahee likes this.
Thread Status:
Not open for further replies.

Share This Page