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
BiomeMap
s are used to map data values to Biome
constants.
We heavily utilise this method of data mapping for GEOResource
s, especially
when supporting multiple versions of Minecraft. This way, we can have different BiomeMap
s
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 TypeMethodDescriptionboolean
containsKey
(org.bukkit.block.Biome biome) boolean
containsValue
(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.NamespacedKey
getKey()
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) boolean
isEmpty()
This returns whether thisBiomeMap
is empty.boolean
void
void
boolean
remove
(org.bukkit.block.Biome biome) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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
BiomeMap
is empty.
-
put
-
putAll
-
putAll
-
remove
public boolean remove(@Nonnull org.bukkit.block.Biome biome) -
getKey
@Nonnull public org.bukkit.NamespacedKey getKey()- Specified by:
getKey
in 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
-