Continued FastItemStack development

This commit is contained in:
Auxilor
2021-08-03 16:20:05 +01:00
parent a4909453d7
commit 6cf9a53a65
5 changed files with 54 additions and 4 deletions

View File

@@ -9,6 +9,10 @@ import java.util.Map;
/**
* FastItemStack contains methods to modify and read items faster than in default bukkit.
* <p>
* If the ItemStack wrapped is a CraftItemStack, then the instance will be modified, allowing for set methods to work.
* <p>
* Otherwise, the FastItemStack must then be unwrapped to get a bukkit copy.
*/
public interface FastItemStack {
/**
@@ -29,6 +33,22 @@ public interface FastItemStack {
int getLevelOnItem(@NotNull Enchantment enchantment,
boolean checkStored);
/**
* Unwrap an ItemStack.
*
* @return The bukkit ItemStack.
*/
ItemStack unwrap();
/**
* If the FastItemStack modifies the actual ItemStack instance or a copy.
* <p>
* If a copy, then {@link FastItemStack#unwrap()} must be called in order to obtain the modified Bukkit ItemStack.
*
* @return If the ItemStack wrapped is a CraftItemStack, allowing for direct modification.
*/
boolean isModifyingInstance();
/**
* Wrap an ItemStack to create a FastItemStack.
*