How to get Path.... If i have an Config like this: http://hastebin.com/alofesovuc.rb and i want to know the path to Kiwanga... here ReMo.Kiwanga but i have just Kiwanga how do i get the "ReMo"? Thanks for your support ~Kiwanga
You could iterate through the keys and check if contains kongwa, but you should probably think about redoing how you are storing information.
@Kiwanga So you have a value and not the key? Why are you storing so you don't know the key but the value? Can you please show how you're storing this.
You could store everything twice, for ease of lookup, so you would have a key with the UUID which has the clan, and a key with the clan that has the list of UUIDs. e.g. http://hastebin.com/gehekekasa.xml @bwfcwalshy There is a hastebin link showing how it's stored in the OP.
@Mrs. bwfctower but then i have to save it 2 times... 1time for the clan and 1time for the players who has a clan.. but i want to save it just 1time xD
@Kiwanga The most efficient way to do this would be to have two saves, one with UUIDs associated with clans and one with clans associated with the member UUIDs, as recommended by the people above. The other way to do this would be to get the configuration section (i.e. the clan) or loop through all the configuration sections and use the MemorySection#getKeys() method to look for the UUID of the player you are checking. The latter would be vastly inefficient if run on a large scale. If you want to limit it to one file, then you can create a yaml with two sections: clans and players. Within the clans section, you would have each clan associated with their respective members, and within the players sections, you would have the player's UUID associated with his/her clan. If the player's UUID is not in the players section, then that player is not in a clan. Hopefully this helps you understand how to structure files and how you can use them for your purpose.
Ok Thank you all but now im doing 1Config with 2Sections. 1Section for the Clans and 1Section for the Players, who have a clan.... But now i get errors, when i try to create my ocnfig... first i got an IOException but then i googled much and updated my code and now i get a NullPoinetException maybe you can help... My code: http://hastebin.com/xatedupido.coffee And i get the Null at this line: if (Main.getInstance().getDataFolder().exists()) { Hope you can help ~Kiwanga