diff options
author | Fabian Faßbender <fabian.fassbender42@googlemail.com> | 2014-12-14 16:24:09 +0100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-02-15 12:31:25 +1100 |
commit | 66c832f8ca365c528aab0250a93fe46b91f2ca56 (patch) | |
tree | 426a3a016c6d07bc2e669abc2c7774520425285a | |
parent | 0f0e31b86bec91e2c1d5d4186e722c863b6b644c (diff) | |
download | bukkit-66c832f8ca365c528aab0250a93fe46b91f2ca56.tar bukkit-66c832f8ca365c528aab0250a93fe46b91f2ca56.tar.gz bukkit-66c832f8ca365c528aab0250a93fe46b91f2ca56.tar.lz bukkit-66c832f8ca365c528aab0250a93fe46b91f2ca56.tar.xz bukkit-66c832f8ca365c528aab0250a93fe46b91f2ca56.zip |
API for setting/removing hideflags on ItemStacks
-rw-r--r-- | src/main/java/org/bukkit/inventory/ItemFlag.java | 32 | ||||
-rw-r--r-- | src/main/java/org/bukkit/inventory/meta/ItemMeta.java | 31 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java new file mode 100644 index 00000000..2a8af7ba --- /dev/null +++ b/src/main/java/org/bukkit/inventory/ItemFlag.java @@ -0,0 +1,32 @@ +package org.bukkit.inventory; + +/** + * A ItemFlag can hide some Attributes from ItemStacks + */ +public enum ItemFlag { + + /** + * Setting to show/hide enchants + */ + HIDE_ENCHANTS, + /** + * Setting to show/hide Attributes like Damage + */ + HIDE_ATTRIBUTES, + /** + * Setting to show/hide the unbreakable State + */ + HIDE_UNBREAKABLE, + /** + * Setting to show/hide what the ItemStack can break/destroy + */ + HIDE_DESTROYS, + /** + * Setting to show/hide where this ItemStack can be build/placed on + */ + HIDE_PLACED_ON, + /** + * Setting to show/hide potion effects on this ItemStack + */ + HIDE_POTION_EFFECTS; +} diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 00f71ce2..459e09ca 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java @@ -2,9 +2,11 @@ package org.bukkit.inventory.meta; import java.util.List; import java.util.Map; +import java.util.Set; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemFlag; /** * This type represents the storage mechanism for auxiliary item data. @@ -124,6 +126,35 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { */ boolean hasConflictingEnchant(Enchantment ench); + /** + * Set itemflags which should be ignored when rendering a ItemStack in the Client. This Method does silently ignore double set itemFlags. + * + * @param itemFlags The hideflags which shouldn't be rendered + */ + void addItemFlags(ItemFlag... itemFlags); + + /** + * Remove specific set of itemFlags. This tells the Client it should render it again. This Method does silently ignore double removed itemFlags. + * + * @param itemFlags Hideflags which should be removed + */ + void removeItemFlags(ItemFlag... itemFlags); + + /** + * Get current set itemFlags. The collection returned is unmodifiable. + * + * @return A set of all itemFlags set + */ + Set<ItemFlag> getItemFlags(); + + /** + * Check if the specified flag is present on this item. + * + * @param flag the flag to check + * @return if it is present + */ + boolean hasItemFlag(ItemFlag flag); + @SuppressWarnings("javadoc") ItemMeta clone(); } |