Package org.bukkit
Interface UnsafeValues
Deprecated.
This interface provides value conversions that may be specific to a
runtime, or have arbitrary meaning (read: magic values).
Their existence and behavior is not guaranteed across future versions. They may be poorly named, throw exceptions, have misleading parameters, or any other bad programming practice.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
Deprecated, for removal: This API element is subject to removal in a future version.net.kyori.adventure.text.flattener.ComponentFlattener
Deprecated.List
<net.kyori.adventure.text.Component> computeTooltipLines
(@NotNull ItemStack itemStack, TooltipContext tooltipContext, Player player) Deprecated.createDamageSourceBuilder
(@NotNull DamageType damageType) Deprecated.Create a newDamageSource.Builder
.Deprecated.default @NotNull Entity
deserializeEntity
(byte @NotNull [] data, @NotNull World world) Deprecated.Deserializes the entity from data.default @NotNull Entity
deserializeEntity
(byte @NotNull [] data, @NotNull World world, boolean preserveUUID) Deprecated.Deserializes the entity from data.@NotNull Entity
deserializeEntity
(byte @NotNull [] data, @NotNull World world, boolean preserveUUID, boolean preservePassengers) Deprecated.Deserializes the entity from data.deserializeItem
(byte[] data) Deprecated.@NotNull ItemStack
deserializeItemFromJson
(com.google.gson.JsonObject data) Deprecated.Creates an itemstack from a json object.@NotNull ItemStack
deserializeStack
(@NotNull Map<String, Object> args) Deprecated.fromLegacy
(Material material) Deprecated.fromLegacy
(MaterialData material) Deprecated.fromLegacy
(MaterialData material, boolean itemPriority) Deprecated.fromLegacy
(Material material, byte data) Deprecated.<B extends Keyed>
Bget
(RegistryKey<B> registry, NamespacedKey key) Deprecated.Deprecated.@NotNull NamespacedKey
getBiomeKey
(RegionAccessor accessor, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.custom biomes are properly supported in API nowgetBlockTranslationKey
(Material material) Deprecated, for removal: This API element is subject to removal in a future version.getCreativeCategory
(Material material) Deprecated, for removal: This API element is subject to removal in a future version.int
Deprecated.getDefaultAttributeModifiers
(Material material, EquipmentSlot slot) Deprecated, for removal: This API element is subject to removal in a future version.getDefaultEntityAttributes
(@NotNull NamespacedKey entityKey) Deprecated.Gets the default attributes for the entity represented by the namespaced key.Deprecated, for removal: This API element is subject to removal in a future version.getItemTranslationKey
(Material material) Deprecated, for removal: This API element is subject to removal in a future version.@NotNull String
Deprecated.Just don't use it.getMaterial
(String material, int version) Deprecated.int
Deprecated.Returns the server's protocol version.@Nullable Color
getSpawnEggLayerColor
(EntityType entityType, int layer) Deprecated.the color is no longer available to the servergetStatisticCriteriaKey
(Statistic statistic) Deprecated.getTranslationKey
(Attribute attribute) Deprecated, for removal: This API element is subject to removal in a future version.getTranslationKey
(EntityType entityType) Deprecated.getTranslationKey
(ItemStack itemStack) Deprecated.default VersionFetcher
Deprecated.Called once by the version command on first use, then cached.net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
Deprecated, for removal: This API element is subject to removal in a future version.boolean
hasDefaultEntityAttributes
(@NotNull NamespacedKey entityKey) Deprecated.Checks if the entity represented by the namespaced key has default attributes.static boolean
isLegacyPlugin
(Plugin plugin) Deprecated, for removal: This API element is subject to removal in a future version.boolean
isSupportedApiVersion
(String apiVersion) Deprecated, for removal: This API element is subject to removal in a future version.boolean
isValidRepairItemStack
(@NotNull ItemStack itemToBeRepaired, @NotNull ItemStack repairMaterial) Deprecated.Checks if an itemstack can be repaired with another itemstack.net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
Deprecated, for removal: This API element is subject to removal in a future version.loadAdvancement
(NamespacedKey key, String advancement) Deprecated.Load an advancement represented by the specified string into the server.modifyItemStack
(ItemStack stack, String arguments) Deprecated.int
Deprecated.Creates and returns the next EntityId available.net.kyori.adventure.text.serializer.plain.PlainComponentSerializer
Deprecated, for removal: This API element is subject to removal in a future version.net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
Deprecated, for removal: This API element is subject to removal in a future version.byte[]
processClass
(PluginDescriptionFile pdf, String path, byte[] clazz) Deprecated.boolean
Deprecated.Delete an advancement which was loaded and saved byloadAdvancement(org.bukkit.NamespacedKey, java.lang.String)
.net.kyori.adventure.text.Component
resolveWithContext
(net.kyori.adventure.text.Component component, CommandSender context, Entity scoreboardSubject, boolean bypassPermissions) Deprecated.default byte @NotNull []
serializeEntity
(@NotNull Entity entity) Deprecated.Serializes the provided entity.byte @NotNull []
serializeEntity
(@NotNull Entity entity, @NotNull EntitySerializationFlag... serializationFlags) Deprecated.Serializes the provided entity.byte[]
serializeItem
(ItemStack item) Deprecated.com.google.gson.JsonObject
serializeItemAsJson
(@NotNull ItemStack itemStack) Deprecated.Serializes this itemstack to json format.serializeStack
(ItemStack itemStack) Deprecated.void
setBiomeKey
(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey) Deprecated, for removal: This API element is subject to removal in a future version.custom biomes are properly supported in API nowDeprecated.
-
Method Details
-
componentFlattener
net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener()Deprecated. -
plainComponentSerializer
@Deprecated(forRemoval=true) net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer()Deprecated, for removal: This API element is subject to removal in a future version. -
plainTextSerializer
@Deprecated(forRemoval=true) net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer()Deprecated, for removal: This API element is subject to removal in a future version. -
gsonComponentSerializer
@Deprecated(forRemoval=true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer()Deprecated, for removal: This API element is subject to removal in a future version. -
colorDownsamplingGsonComponentSerializer
@Deprecated(forRemoval=true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer()Deprecated, for removal: This API element is subject to removal in a future version. -
legacyComponentSerializer
@Deprecated(forRemoval=true) net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer()Deprecated, for removal: This API element is subject to removal in a future version. -
resolveWithContext
net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, CommandSender context, Entity scoreboardSubject, boolean bypassPermissions) throws IOException Deprecated.- Throws:
IOException
-
toLegacy
Deprecated. -
fromLegacy
Deprecated. -
fromLegacy
Deprecated. -
fromLegacy
Deprecated. -
fromLegacy
Deprecated. -
getMaterial
Deprecated. -
getDataVersion
int getDataVersion()Deprecated. -
modifyItemStack
Deprecated. -
checkSupported
Deprecated.- Throws:
InvalidPluginException
-
processClass
Deprecated. -
loadAdvancement
Deprecated.Load an advancement represented by the specified string into the server. The advancement format is governed by Minecraft and has no specified layout.
It is currently a JSON object, as described by the Minecraft wiki.
Loaded advancements will be stored and persisted across server restarts and reloads.
Callers should be prepared forException
to be thrown.- Parameters:
key
- the unique advancement keyadvancement
- representation of the advancement- Returns:
- the loaded advancement or null if an error occurred
-
removeAdvancement
Deprecated.Delete an advancement which was loaded and saved byloadAdvancement(org.bukkit.NamespacedKey, java.lang.String)
.
This method will only remove advancement from persistent storage. It should be accompanied by a call toServer.reloadData()
in order to fully remove it from the running instance.- Parameters:
key
- the unique advancement key- Returns:
- true if a file matching this key was found and deleted
-
getDefaultAttributeModifiers
@Deprecated(since="1.21", forRemoval=true) Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) Deprecated, for removal: This API element is subject to removal in a future version. -
getCreativeCategory
Deprecated, for removal: This API element is subject to removal in a future version. -
getBlockTranslationKey
Deprecated, for removal: This API element is subject to removal in a future version. -
getItemTranslationKey
Deprecated, for removal: This API element is subject to removal in a future version. -
getTranslationKey
Deprecated. -
getTranslationKey
Deprecated. -
getTranslationKey
Deprecated, for removal: This API element is subject to removal in a future version. -
getInternalPotionData
@Internal @Deprecated(since="1.20.2", forRemoval=true) PotionType.InternalPotionData getInternalPotionData(NamespacedKey key) Deprecated, for removal: This API element is subject to removal in a future version.Do not use, method will get removed, and the plugin won't run- Parameters:
key
- of the potion type- Returns:
- an internal potion data
-
createDamageSourceBuilder
@Internal @NotNull DamageSource.Builder createDamageSourceBuilder(@NotNull @NotNull DamageType damageType) Deprecated.Create a newDamageSource.Builder
.- Parameters:
damageType
- theDamageType
to use- Returns:
- a
DamageSource.Builder
-
get
Deprecated. -
get
Deprecated. -
isSupportedApiVersion
Deprecated, for removal: This API element is subject to removal in a future version. -
isLegacyPlugin
Deprecated, for removal: This API element is subject to removal in a future version. -
getVersionFetcher
Deprecated.Called once by the version command on first use, then cached. -
serializeItem
Deprecated. -
deserializeItem
Deprecated. -
serializeItemAsJson
Deprecated.Serializes this itemstack to json format. It is safe for data migrations as it will use the built-in data converter instead of bukkit's dangerous serialization system.The emitted json object's format will inherently change across versions and hence should not be used for non-development purposes like plugin configurations or end-user input.
- Returns:
- json object representing this item.
- Throws:
IllegalArgumentException
- if the passed itemstack isItemStack.empty()
.- See Also:
-
deserializeItemFromJson
@NotNull @NotNull ItemStack deserializeItemFromJson(@NotNull com.google.gson.JsonObject data) throws IllegalArgumentException Deprecated.Creates an itemstack from a json object.This method expects a json object in the format emitted by
serializeItemAsJson(ItemStack)
.The emitted json object's format will inherently change across versions and hence should not be used for non-development purposes like plugin configurations or end-user input.
- Parameters:
data
- object representing an item in Json format- Returns:
- the deserialize item stack, migrated to the latest data version if needed.
- Throws:
IllegalArgumentException
- if the json object is not a valid item- See Also:
-
serializeEntity
Deprecated.Serializes the provided entity.- Parameters:
entity
- entity- Returns:
- serialized entity data
- Throws:
IllegalArgumentException
- if couldn't serialize the entity- Since:
- 1.17.1
- See Also:
-
serializeEntity
byte @NotNull [] serializeEntity(@NotNull @NotNull Entity entity, @NotNull @NotNull EntitySerializationFlag... serializationFlags) Deprecated.Serializes the provided entity.- Parameters:
entity
- entityserializationFlags
- serialization flags- Returns:
- serialized entity data
- Throws:
IllegalArgumentException
- if couldn't serialize the entity- Since:
- 1.21.4
- See Also:
-
deserializeEntity
@NotNull default @NotNull Entity deserializeEntity(byte @NotNull [] data, @NotNull @NotNull World world) Deprecated.Deserializes the entity from data.
The entity'sUUID
as well as passengers will not be preserved.- Parameters:
data
- serialized entity dataworld
- world- Returns:
- deserialized entity
- Throws:
IllegalArgumentException
- if invalid serialized entity data provided- Since:
- 1.17.1
- See Also:
-
deserializeEntity
@NotNull default @NotNull Entity deserializeEntity(byte @NotNull [] data, @NotNull @NotNull World world, boolean preserveUUID) Deprecated.Deserializes the entity from data.
The entity's passengers will not be preserved.- Parameters:
data
- serialized entity dataworld
- worldpreserveUUID
- whether to preserve the entity's uuid- Returns:
- deserialized entity
- Throws:
IllegalArgumentException
- if invalid serialized entity data provided- Since:
- 1.17.1
- See Also:
-
deserializeEntity
@NotNull @NotNull Entity deserializeEntity(byte @NotNull [] data, @NotNull @NotNull World world, boolean preserveUUID, boolean preservePassengers) Deprecated.Deserializes the entity from data.- Parameters:
data
- serialized entity dataworld
- worldpreserveUUID
- whether to preserve uuids of the entity and its passengerspreservePassengers
- whether to preserve passengers- Returns:
- deserialized entity
- Throws:
IllegalArgumentException
- if invalid serialized entity data provided- Since:
- 1.21.4
- See Also:
-
nextEntityId
int nextEntityId()Deprecated.Creates and returns the next EntityId available.Use this when sending custom packets, so that there are no collisions on the client or server.
-
getMainLevelName
Deprecated.Just don't use it. -
getProtocolVersion
int getProtocolVersion()Deprecated.Returns the server's protocol version.- Returns:
- the server's protocol version
-
isValidRepairItemStack
boolean isValidRepairItemStack(@NotNull @NotNull ItemStack itemToBeRepaired, @NotNull @NotNull ItemStack repairMaterial) Deprecated.Checks if an itemstack can be repaired with another itemstack. Returns false if either argument's type is not an item (Material.isItem()
).- Parameters:
itemToBeRepaired
- the itemstack to be repairedrepairMaterial
- the repair material- Returns:
- true if valid repair, false if not
-
hasDefaultEntityAttributes
Deprecated.Checks if the entity represented by the namespaced key has default attributes.- Parameters:
entityKey
- the entity's key- Returns:
- true if it has default attributes
-
getDefaultEntityAttributes
Deprecated.Gets the default attributes for the entity represented by the namespaced key.- Parameters:
entityKey
- the entity's key- Returns:
- an unmodifiable instance of Attributable for reading default attributes.
- Throws:
IllegalArgumentException
- if the entity does not exist of have default attributes (usehasDefaultEntityAttributes(NamespacedKey)
first)
-
getBiomeKey
@NotNull @Deprecated(since="1.21.3", forRemoval=true) @NotNull NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.custom biomes are properly supported in API nowGets theNamespacedKey
for the biome at the given location.- Parameters:
accessor
- TheRegionAccessor
of the provided coordinatesx
- X-coordinate of the blocky
- Y-coordinate of the blockz
- Z-coordinate of the block- Returns:
- the biome's
NamespacedKey
-
setBiomeKey
@Deprecated(since="1.21.3", forRemoval=true) void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey) Deprecated, for removal: This API element is subject to removal in a future version.custom biomes are properly supported in API nowSets the biome at the given location to a biome registered to the givenNamespacedKey
. If no biome by the givenNamespacedKey
exists, anIllegalStateException
will be thrown.- Parameters:
accessor
- TheRegionAccessor
of the provided coordinatesx
- X-coordinate of the blocky
- Y-coordinate of the blockz
- Z-coordinate of the blockbiomeKey
- Biome key- Throws:
IllegalStateException
- if no biome by the given key is registered.
-
getStatisticCriteriaKey
Deprecated. -
getSpawnEggLayerColor
@Deprecated(since="1.21.4") @Nullable @Nullable Color getSpawnEggLayerColor(EntityType entityType, int layer) Deprecated.the color is no longer available to the serverObtains the underlying color informating for a spawn egg of a given entity type, ornull
if the entity passed does not have a spawn egg. Spawn eggs have two colors - the background layer (0), and the foreground layer (1)- Parameters:
entityType
- the entity type to get the color forlayer
- the texture layer to get a color for- Returns:
- the color of the layer for the entity's spawn egg
-
computeTooltipLines
@NotNull List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull @NotNull ItemStack itemStack, @NotNull TooltipContext tooltipContext, @Nullable Player player) Deprecated. -
createEmptyStack
ItemStack createEmptyStack()Deprecated. -
serializeStack
Deprecated. -
deserializeStack
Deprecated.
-