2016-03-01 19:25:51 +01:00
|
|
|
package com.gmail.nossr50.util.adapter;
|
|
|
|
|
2018-08-02 03:23:29 +02:00
|
|
|
import org.bukkit.block.Biome;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import java.util.*;
|
2016-03-01 19:25:51 +01:00
|
|
|
|
|
|
|
public class BiomeAdapter {
|
|
|
|
public static final Set<Biome> WATER_BIOMES;
|
|
|
|
public static final Set<Biome> ICE_BIOMES;
|
|
|
|
|
|
|
|
static {
|
2018-08-02 03:23:29 +02:00
|
|
|
List<Biome> allBiomes = Arrays.asList(Biome.values());
|
|
|
|
List<Biome> waterBiomes = new ArrayList<Biome>();
|
|
|
|
List<Biome> iceBiomes = new ArrayList<Biome>();
|
|
|
|
for (Biome biome : allBiomes) {
|
|
|
|
if (isWater(biome.name()) && !isCold(biome.name())) {
|
|
|
|
waterBiomes.add(biome);
|
|
|
|
} else if (isCold(biome.name())) {
|
|
|
|
iceBiomes.add(biome);
|
2016-03-01 19:25:51 +01:00
|
|
|
}
|
|
|
|
}
|
2018-08-02 03:23:29 +02:00
|
|
|
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"));
|
2016-03-01 19:25:51 +01:00
|
|
|
}
|
|
|
|
}
|