so i made an arraylist. What i was planning on doing was shuffling the arraylist and taking the first material of it to pull out a random item from the config. i forgot how to pull out the first material :/ Code:java // this is my arraylistArrayList<Material> list = (ArrayList<Material>) getConfig().getList("Materials"); // this is what im using to shuffle itCollections.shuffle(list); // i thought this is what i was supposed to do to take the first value from it but i forgot :/list[0]
If you did Material[] list; instead of an ArrayList, you would use list[0];. For this, try using list.get(0);. Seems simple enough.
SmooshCakez thanks _Cookie_ Im new to this and im kinda doing what i know atm so i didnt know a better way. If you wouldnt mind teaching me that would be great
15987632 I'd usually use this method when getting a list. Code:java Material[] list = getConfig().getList("Materials"); Using an ArrayList isn't going to harm you, though.