GeneratorConfig.java 658 B

12345678910111213141516171819202122
  1. package xyz.spaceio.customoregen;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Random;
  5. public class GeneratorConfig {
  6. public List<GeneratorItem> itemList = new ArrayList<GeneratorItem>();
  7. public String permission = ";";
  8. public String label;
  9. public int unlock_islandLevel = 0;
  10. public GeneratorItem getRandomItem() {
  11. Random random = new Random();
  12. double d = random.nextDouble() * 100;
  13. for (GeneratorItem key : this.itemList) {
  14. if ((d -= key.getChance()) < 0)
  15. return key;
  16. }
  17. return new GeneratorItem("COBBLESTONE", (byte) 0, 0); // DEFAULT
  18. }
  19. }