More FastItemStack changes
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package com.willfp.eco.core.display;
|
||||
|
||||
import com.willfp.eco.core.fast.FastItemStack;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -77,8 +75,6 @@ public class Display {
|
||||
return itemStack; // return early if there's no customization of the item
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info((FastItemStack.wrap(itemStack).isModifyingInstance() == (FastItemStack.wrap(itemStack).unwrap() == itemStack)) + " amogus?");
|
||||
|
||||
Map<String, Object[]> pluginVarArgs = new HashMap<>();
|
||||
|
||||
for (DisplayPriority priority : DisplayPriority.values()) {
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.Map;
|
||||
* <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.
|
||||
* Otherwise, apply() must be called in order to apply the changes.
|
||||
* <p>
|
||||
* apply() <b>will</b> call getItemMeta and setItemMeta which will hurt performance, however this will still be faster.
|
||||
*/
|
||||
public interface FastItemStack {
|
||||
/**
|
||||
@@ -34,20 +36,15 @@ public interface FastItemStack {
|
||||
boolean checkStored);
|
||||
|
||||
/**
|
||||
* Unwrap an ItemStack.
|
||||
*
|
||||
* @return The bukkit ItemStack.
|
||||
*/
|
||||
ItemStack unwrap();
|
||||
|
||||
/**
|
||||
* If the FastItemStack modifies the actual ItemStack instance or a copy.
|
||||
* Apply the changes made in FastItemStack.
|
||||
* <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.
|
||||
* If the ItemStack was a CraftItemStack, then no code will run - the changes are automatically applied.
|
||||
* <p>
|
||||
* If the ItemStack wasn't a CraftItemStack, then the unwrapped ItemStack's ItemMeta will be applied to the original ItemStack.
|
||||
* <p>
|
||||
* You should <b>always</b> call apply() if you have used any set methods.
|
||||
*/
|
||||
boolean isModifyingInstance();
|
||||
void apply();
|
||||
|
||||
/**
|
||||
* Wrap an ItemStack to create a FastItemStack.
|
||||
|
||||
Reference in New Issue
Block a user