mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
API for setting/removing hideflags on ItemStacks
By: Fabian Faßbender <fabian.fassbender42@googlemail.com>
This commit is contained in:
parent
e8eb528aba
commit
1917305f97
2 changed files with 63 additions and 0 deletions
32
paper-api/src/main/java/org/bukkit/inventory/ItemFlag.java
Normal file
32
paper-api/src/main/java/org/bukkit/inventory/ItemFlag.java
Normal file
|
@ -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;
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue