Added ItemStack#getAttribute

This commit is contained in:
themode 2020-10-05 01:46:02 +02:00
parent 4eb09e70e7
commit 857d3f0c6e

View File

@ -323,6 +323,20 @@ public class ItemStack implements DataContainer {
return Collections.unmodifiableList(attributes);
}
/**
* Get the {@link ItemAttribute} with the specified internal name
*
* @param internalName the internal name of the attribute
* @return the {@link ItemAttribute} with the internal name, null if not found
*/
public ItemAttribute getAttribute(String internalName) {
for (ItemAttribute itemAttribute : attributes) {
if (itemAttribute.getInternalName().equals(internalName))
return itemAttribute;
}
return null;
}
/**
* Add an attribute to the item
*