mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
#690: Add method to read ItemStack input
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
|
|||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
@@ -128,6 +129,23 @@ public interface ItemFactory {
|
|||||||
@NotNull
|
@NotNull
|
||||||
Color getDefaultLeatherColor();
|
Color getDefaultLeatherColor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link ItemStack} given the supplied input.
|
||||||
|
* <p>
|
||||||
|
* The input should match the same input as expected by Minecraft's {@code /give}
|
||||||
|
* command. For example, "minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness", lvl:3}]}"
|
||||||
|
* would yield an ItemStack of {@link Material#DIAMOND_SWORD} with an {@link ItemMeta}
|
||||||
|
* containing a level 3 {@link Enchantment#DAMAGE_ALL}
|
||||||
|
* enchantment.
|
||||||
|
*
|
||||||
|
* @param input the item input string
|
||||||
|
* @return the created ItemStack
|
||||||
|
* @throws IllegalArgumentException if the input string was provided in an
|
||||||
|
* invalid or unsupported format
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
ItemStack createItemStack(@NotNull String input) throws IllegalArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply a material change for an item meta. Do not use under any
|
* Apply a material change for an item meta. Do not use under any
|
||||||
* circumstances.
|
* circumstances.
|
||||||
|
@@ -358,6 +358,18 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
|||||||
*/
|
*/
|
||||||
boolean removeAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier);
|
boolean removeAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get this ItemMeta as an NBT string.
|
||||||
|
* <p>
|
||||||
|
* This string should not be relied upon as a serializable value. If
|
||||||
|
* serialization is desired, the {@link ConfigurationSerializable} API
|
||||||
|
* should be used instead.
|
||||||
|
*
|
||||||
|
* @return the NBT string
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
String getAsString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a public custom tag container capable of storing tags on the
|
* Returns a public custom tag container capable of storing tags on the
|
||||||
* item.
|
* item.
|
||||||
|
Reference in New Issue
Block a user