Biome needs to be in the enum compatability as well.

This commit is contained in:
t00thpick1 2016-03-01 13:25:51 -05:00
parent 88b99a3835
commit f77ae6ee15
2 changed files with 76 additions and 6 deletions

View File

@ -15,6 +15,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.adapter.BiomeAdapter;
public final class Fishing {
// The order of the values is extremely important, a few methods depend on it to work properly
@ -57,12 +58,8 @@ public final class Fishing {
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5;
public static Set<Biome> masterAnglerBiomes = EnumSet.of(Biome.RIVER, Biome.OCEAN, Biome.DEEP_OCEAN);
public static Set<Biome> iceFishingBiomes = EnumSet.of(
Biome.FROZEN_OCEAN, Biome.FROZEN_RIVER,
Biome.TAIGA, Biome.TAIGA_HILLS, Biome.TAIGA_COLD_HILLS,
Biome.ICE_FLATS, Biome.ICE_MOUNTAINS, Biome.MUTATED_ICE_FLATS,
Biome.TAIGA_COLD, Biome.MUTATED_TAIGA_COLD);
public static Set<Biome> masterAnglerBiomes = BiomeAdapter.WATER_BIOMES;
public static Set<Biome> iceFishingBiomes = BiomeAdapter.ICE_BIOMES;
private Fishing() {}

View File

@ -0,0 +1,73 @@
package com.gmail.nossr50.util.adapter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import org.bukkit.block.Biome;
import com.gmail.nossr50.mcMMO;
public class BiomeAdapter {
public static final Set<Biome> WATER_BIOMES;
public static final Set<Biome> ICE_BIOMES;
static {
List<Biome> temp = new ArrayList<Biome>();
EnumSet<Biome> set = null;
try {
temp.add(Biome.valueOf("RIVER"));
temp.add(Biome.valueOf("OCEAN"));
temp.add(Biome.valueOf("DEEP_OCEAN"));
} catch (Exception e) {
temp.clear();
} finally {
try {
set = EnumSet.copyOf(temp);
} catch (IllegalArgumentException e) {
mcMMO.p.getLogger().severe("Biome enum mismatch");;
}
temp.clear();
}
WATER_BIOMES = set;
set = null;
try {
temp.add(Biome.valueOf("FROZEN_OCEAN"));
temp.add(Biome.valueOf("FROZEN_RIVER"));
temp.add(Biome.valueOf("TAIGA"));
temp.add(Biome.valueOf("TAIGA_HILLS"));
temp.add(Biome.valueOf("TAIGA_COLD_HILLS"));
temp.add(Biome.valueOf("TAIGA_COLD"));
temp.add(Biome.valueOf("MUTATED_TAIGA_COLD"));
temp.add(Biome.valueOf("ICE_MOUNTAINS"));
temp.add(Biome.valueOf("ICE_FLATS"));
temp.add(Biome.valueOf("MUTATED_ICE_FLATS"));
} catch (Exception e) {
temp.clear();
try {
temp.add(Biome.valueOf("FROZEN_OCEAN"));
temp.add(Biome.valueOf("FROZEN_RIVER"));
temp.add(Biome.valueOf("TAIGA"));
temp.add(Biome.valueOf("TAIGA_HILLS"));
temp.add(Biome.valueOf("TAIGA_MOUNTAINS"));
temp.add(Biome.valueOf("COLD_TAIGA"));
temp.add(Biome.valueOf("COLD_TAIGA_HILLS"));
temp.add(Biome.valueOf("COLD_TAIGA_MOUNTAINS"));
temp.add(Biome.valueOf("ICE_MOUNTAINS"));
temp.add(Biome.valueOf("ICE_PLAINS"));
temp.add(Biome.valueOf("ICE_PLAINS_SPIKES"));
} catch (Exception e1) {
temp.clear();
}
} finally {
try {
set = EnumSet.copyOf(temp);
} catch (IllegalArgumentException e) {
mcMMO.p.getLogger().severe("Biome enum mismatch");;
}
temp.clear();
}
ICE_BIOMES = set;
}
}