package com.gmail.nossr50.util.adapter; import org.bukkit.block.Biome; import java.util.*; public class BiomeAdapter { public static final Set WATER_BIOMES; public static final Set ICE_BIOMES; static { List allBiomes = Arrays.asList(Biome.values()); List waterBiomes = new ArrayList(); List iceBiomes = new ArrayList(); for (Biome biome : allBiomes) { if (isWater(biome.name()) && !isCold(biome.name())) { waterBiomes.add(biome); } else if (isCold(biome.name())) { iceBiomes.add(biome); } } WATER_BIOMES = EnumSet.copyOf(waterBiomes); ICE_BIOMES = EnumSet.copyOf(iceBiomes); } private static boolean isWater(String name) { return name.contains("RIVER") || name.contains("OCEAN"); } private static boolean isCold(String name) { return (name.contains("COLD") || name.contains("ICE") || name.contains("FROZEN") || name.contains("TAIGA")) && !(name.contains("WARM")); } }