Interface UnsafeValues


@Deprecated(since="1.7.2") public 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.

Since:
1.7.2
  • Method Details

    • toLegacy

      Material toLegacy(Material material)
      Deprecated.
      Since:
      1.13
    • fromLegacy

      Material fromLegacy(Material material)
      Deprecated.
      Since:
      1.13
    • fromLegacy

      Material fromLegacy(MaterialData material)
      Deprecated.
      Since:
      1.13
    • fromLegacy

      Material fromLegacy(MaterialData material, boolean itemPriority)
      Deprecated.
      Since:
      1.13
    • fromLegacy

      BlockData fromLegacy(Material material, byte data)
      Deprecated.
      Since:
      1.13
    • getMaterial

      Material getMaterial(String material, int version)
      Deprecated.
      Since:
      1.14
    • getDataVersion

      int getDataVersion()
      Deprecated.
      Since:
      1.13
    • modifyItemStack

      ItemStack modifyItemStack(ItemStack item, String components)
      Deprecated.
      Since:
      1.7.2
    • checkSupported

      void checkSupported(PluginDescriptionFile pdf) throws InvalidPluginException
      Deprecated.
      Throws:
      InvalidPluginException
      Since:
      1.13
    • processClass

      byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz)
      Deprecated.
      Since:
      1.13
    • loadAdvancement

      @Nullable default @Nullable Advancement loadAdvancement(NamespacedKey key, @Language("json") String advancement)
      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.

      Parameters:
      key - the unique advancement key
      advancement - representation of the advancement
      Returns:
      the loaded advancement or null if an error occurred
      Since:
      1.12
    • loadAdvancement

      @Nullable @Nullable Advancement loadAdvancement(net.kyori.adventure.key.Key key, @Language("json") String advancement, boolean persist)
      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 only be stored and persisted across server restarts and reloads, if the persist parameter is set to true.

      Parameters:
      key - the unique advancement key
      advancement - representation of the advancement
      persist - whether to store this advancement in the bukkit datapack for persistence
      Returns:
      the loaded advancement or null if an error occurred
      Since:
      26.2
    • loadAdvancements

      List<Advancement> loadAdvancements(Map<net.kyori.adventure.key.Key, String> advancements, boolean persist)
      Deprecated.
      Load multiple advancements represented by the specified strings 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 only be stored and persisted across server restarts and reloads, if the persist parameter is set to true.

      Callers should be prepared for Exception to be thrown.

      Parameters:
      advancements - the advancements to register. The key is the unique advancement key and the value is the advancement's JSON representation
      persist - whether to store this advancement in the bukkit datapack for persistence
      Returns:
      list of all successfully loaded advancements
      Since:
      26.2
    • removeAdvancement

      boolean removeAdvancement(NamespacedKey key)
      Deprecated.
      Delete an advancement which was loaded and saved by loadAdvancement(Key, String, boolean) or loadAdvancements(Map, boolean).

      This method will only remove advancement from persistent storage. It should be accompanied by a call to Server.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
      Since:
      1.12
    • 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
    • get

      @Internal String get(Class<?> elementClass, String value)
      Deprecated.
    • get

      @Internal @Nullable <B extends Keyed> B get(RegistryKey<B> registry, NamespacedKey key)
      Deprecated.
    • isSupportedApiVersion

      @Deprecated(forRemoval=true) boolean isSupportedApiVersion(String apiVersion)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isLegacyPlugin

      @Deprecated(forRemoval=true) static boolean isLegacyPlugin(Plugin plugin)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • serializeItemAsJson

      @NotNull com.google.gson.JsonObject serializeItemAsJson(@NotNull @NotNull ItemStack itemStack)
      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 is ItemStack.empty().
      Since:
      1.21.1
      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
      Since:
      1.21.1
      See Also:
    • serializeEntity

      default byte @NotNull [] serializeEntity(@NotNull @NotNull Entity entity)
      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 - entity
      serializationFlags - 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's UUID as well as passengers will not be preserved.
      Parameters:
      data - serialized entity data
      world - 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 data
      world - world
      preserveUUID - 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 data
      world - world
      preserveUUID - whether to preserve uuids of the entity and its passengers
      preservePassengers - whether to preserve passengers
      Returns:
      deserialized entity
      Throws:
      IllegalArgumentException - if invalid serialized entity data provided
      Since:
      1.21.4
      See Also:
    • nextEntityId

      int nextEntityId(World world)
      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.

      Since:
      26.2
    • getMainLevelName

      @NotNull @NotNull String getMainLevelName()
      Deprecated.
      Just don't use it.
      Since:
      1.18.2
    • getProtocolVersion

      int getProtocolVersion()
      Deprecated.
      Returns the server's protocol version.
      Returns:
      the server's protocol version
      Since:
      1.16.5
    • deserializeStack

      @NotNull @NotNull ItemStack deserializeStack(@NotNull @NotNull Map<String,Object> args)
      Deprecated.
      Since:
      1.21.6
    • deserializeItemHover

      @NotNull @NotNull ItemStack deserializeItemHover(@NotNull net.kyori.adventure.text.event.HoverEvent.ShowItem itemHover)
      Deprecated.
      Deserializes a HoverEvent.ShowItem hover event value into an ItemStack.
      Parameters:
      itemHover - the hover to deserialize
      Returns:
      the deserialized ItemStack
      Since:
      1.21.11