Class BiomeMap<T>
java.lang.Object
io.github.thebusybiscuit.slimefun4.utils.biomes.BiomeMap<T>
- Type Parameters:
T- The stored data type
- All Implemented Interfaces:
net.kyori.adventure.key.Keyed,org.bukkit.Keyed
BiomeMaps are used to map data values to Biome constants.
We heavily utilise this method of data mapping for GEOResources, especially
when supporting multiple versions of Minecraft. This way, we can have different BiomeMaps
for different versions of Minecraft, in case Biome names change in-between versions.
The data type can be any type of Object.
The most common type is Integer, if you are using complex objects and try to read
your BiomeMap from a JsonElement, make sure to provide an adequate
BiomeDataConverter to convert the raw json data.
- Author:
- TheBusyBiscuit
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(org.bukkit.block.Biome biome) booleancontainsValue(T value) static <T> BiomeMap<T> fromJson(org.bukkit.NamespacedKey key, String json, BiomeDataConverter<T> valueConverter) static <T> BiomeMap<T> fromJson(org.bukkit.NamespacedKey key, String json, BiomeDataConverter<T> valueConverter, boolean isLenient) static <T> BiomeMap<T> fromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path, BiomeDataConverter<T> valueConverter) get(org.bukkit.block.Biome biome) getIntMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) org.bukkit.NamespacedKeygetKey()getLongMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) getOrDefault(org.bukkit.block.Biome biome, T defaultValue) getStringMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) booleanisEmpty()This returns whether thisBiomeMapis empty.booleanvoidvoidbooleanremove(org.bukkit.block.Biome biome) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.Keyed
key
-
Constructor Details
-
Method Details
-
get
-
getOrDefault
-
containsKey
public boolean containsKey(@Nonnull org.bukkit.block.Biome biome) -
containsValue
-
isEmpty
public boolean isEmpty()- Returns:
- Whether this
BiomeMapis empty.
-
put
-
putAll
-
putAll
-
remove
public boolean remove(@Nonnull org.bukkit.block.Biome biome) -
getKey
@Nonnull public org.bukkit.NamespacedKey getKey()- Specified by:
getKeyin interfaceorg.bukkit.Keyed
-
toString
-
fromJson
@ParametersAreNonnullByDefault @Nonnull public static <T> BiomeMap<T> fromJson(org.bukkit.NamespacedKey key, String json, BiomeDataConverter<T> valueConverter) throws BiomeMapException - Throws:
BiomeMapException
-
fromJson
@ParametersAreNonnullByDefault @Nonnull public static <T> BiomeMap<T> fromJson(org.bukkit.NamespacedKey key, String json, BiomeDataConverter<T> valueConverter, boolean isLenient) throws BiomeMapException - Throws:
BiomeMapException
-
fromResource
@ParametersAreNonnullByDefault @Nonnull public static <T> BiomeMap<T> fromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path, BiomeDataConverter<T> valueConverter) throws BiomeMapException - Throws:
BiomeMapException
-
getIntMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<Integer> getIntMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-
getLongMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<Long> getLongMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-
getStringMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<String> getStringMapFromResource(org.bukkit.NamespacedKey key, org.bukkit.plugin.java.JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-