Replace ItemTag API with new API that also expands to Tiles and Entities

By: Bjarne Koll <LynxPlay101@gmail.com>
This commit is contained in:
Bukkit/Spigot
2019-04-25 14:24:05 +10:00
parent 3209bcbf56
commit ddfd4b10c4
30 changed files with 416 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.meta.tags.CustomItemTagContainer;
import org.bukkit.persistence.PersistentDataHolder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -21,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
* An implementation will handle the creation and application for ItemMeta.
* This class should not be implemented by a plugin in a live environment.
*/
public interface ItemMeta extends Cloneable, ConfigurationSerializable {
public interface ItemMeta extends Cloneable, ConfigurationSerializable, PersistentDataHolder {
/**
* Checks for existence of a display name.
@@ -368,8 +369,11 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
* These tags can also be modified by the client once in creative mode
*
* @return the custom tag container
* @deprecated this API part has been replaced by the {@link PersistentDataHolder} API.
* Please use {@link PersistentDataHolder#getPersistentDataContainer()} instead of this.
*/
@NotNull
@Deprecated
CustomItemTagContainer getCustomTagContainer();
/**

View File

@@ -8,7 +8,12 @@ import org.jetbrains.annotations.Nullable;
/**
* This interface represents a map like object, capable of storing custom tags
* in it.
*
* @deprecated this API part has been replaced by the
* {@link org.bukkit.persistence.PersistentDataHolder} API. Please use
* {@link org.bukkit.persistence.PersistentDataHolder} instead of this.
*/
@Deprecated
public interface CustomItemTagContainer {
/**

View File

@@ -1,11 +1,17 @@
package org.bukkit.inventory.meta.tags;
import org.bukkit.persistence.PersistentDataAdapterContext;
import org.bukkit.persistence.PersistentDataHolder;
import org.jetbrains.annotations.NotNull;
/**
* This interface represents the context in which the {@link ItemTagType} can
* serialize and deserialize the passed values.
*
* @deprecated this API part has been replaced by {@link PersistentDataHolder}.
* Please use {@link PersistentDataAdapterContext} instead of this.
*/
@Deprecated
public interface ItemTagAdapterContext {
/**

View File

@@ -1,5 +1,6 @@
package org.bukkit.inventory.meta.tags;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
/**
@@ -42,7 +43,10 @@ import org.jetbrains.annotations.NotNull;
*
* @param <T> the primary object type that is stored in the given tag
* @param <Z> the retrieved object type when applying this item tag type
*
* @deprecated please use {@link PersistentDataType} as this part of the api is being replaced
*/
@Deprecated
public interface ItemTagType<T, Z> {
/*