mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
fdd951f1f1
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package com.gmail.nossr50.util.adapter;
|
|
|
|
import org.bukkit.block.Biome;
|
|
|
|
import java.util.*;
|
|
|
|
public class BiomeAdapter {
|
|
public static final Set<Biome> WATER_BIOMES;
|
|
public static final Set<Biome> ICE_BIOMES;
|
|
|
|
static {
|
|
List<Biome> allBiomes = Arrays.asList(Biome.values());
|
|
List<Biome> waterBiomes = new ArrayList<>();
|
|
List<Biome> 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"));
|
|
}
|
|
}
|