Hi, i want to get the data from all data in my config.yml for example i want get the integer from: player1: 10 player2: 16 player3: 15 i want get and collect in array all integers.
Get the configuration section that is storing all the players, use getConfig().getKeys() in a loop, then use getConfig().getInt(*String Path*); and add them all to an array.
You'll actually want to use getConfig().getKeys(true) because you want to collect keys with values. Not trying to be rude to you @Hunky524 just expanding on your idea.
Useless if there's only what author said in his file. getKeys(true) is for getting subvalues, like players: player1: 10 getKeys(false) will return "players" and getKeys(true) will return "players" "player1"
I don't think that's true, I think the point of getting keys will only get the config sections if false, if true then it will list keys with values attached, at least that's what I've seen work before. If I'm wrong feel free to link me to a javadoc or something that supports your point of view. I might be wrong in this.
Code (Java): Set<String> sets = Config#getConfigurationSection(String path)#getKeys(boolean value); for(int i : sets + p.getName()) { // i returns to the playername's int value }
With a for each loop you dont have to get the element with the int plus a Set doesn't give you a direct method to get the element unlike with an ArrayList with #get()
Code (Java): FileInputStream fs=newFileInputStream("someFile.txt"); BufferedReader br =newBufferedReader(newInputStreamReader(fs)); for(int i =0; i <31;++i) br.readLine(); String lineIWant = br.readLine();
That literally has no relevance to anything mentioned in the thread, other than that you're interacting with a File in a way that, still, wasn't mentioned in this thread.
Why would you take the extra step to store the set in temporary memory if you're just wasting a line, I mean what else will you do with the set?
He seems to have his own skewed views of Java conventions so he probably thought it was what the OP was asking about.