Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EnchantmentStorageMeta.java
1 package org.bukkit.inventory.meta;
2 
3 import java.util.Map;
4 
5 import org.bukkit.Material;
7 
8 /**
9  * EnchantmentMeta is specific to items that can <i>store</i> enchantments, as
10  * opposed to being enchanted. {@link Material#ENCHANTED_BOOK} is an example
11  * of an item with enchantment storage.
12  */
13 public interface EnchantmentStorageMeta extends ItemMeta {
14 
15  /**
16  * Checks for the existence of any stored enchantments.
17  *
18  * @return true if an enchantment exists on this meta
19  */
20  boolean hasStoredEnchants();
21 
22  /**
23  * Checks for storage of the specified enchantment.
24  *
25  * @param ench enchantment to check
26  * @return true if this enchantment is stored in this meta
27  */
28  boolean hasStoredEnchant(Enchantment ench);
29 
30  /**
31  * Checks for the level of the stored enchantment.
32  *
33  * @param ench enchantment to check
34  * @return The level that the specified stored enchantment has, or 0 if
35  * none
36  */
38 
39  /**
40  * Gets a copy the stored enchantments in this ItemMeta.
41  *
42  * @return An immutable copy of the stored enchantments
43  */
44  Map<Enchantment, Integer> getStoredEnchants();
45 
46  /**
47  * Stores the specified enchantment in this item meta.
48  *
49  * @param ench Enchantment to store
50  * @param level Level for the enchantment
51  * @param ignoreLevelRestriction this indicates the enchantment should be
52  * applied, ignoring the level limit
53  * @return true if the item meta changed as a result of this call, false
54  * otherwise
55  * @throws IllegalArgumentException if enchantment is null
56  */
57  boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction);
58 
59  /**
60  * Remove the specified stored enchantment from this item meta.
61  *
62  * @param ench Enchantment to remove
63  * @return true if the item meta changed as a result of this call, false
64  * otherwise
65  * @throws IllegalArgumentException if enchantment is null
66  */
67  boolean removeStoredEnchant(Enchantment ench) throws IllegalArgumentException;
68 
69  /**
70  * Checks if the specified enchantment conflicts with any enchantments in
71  * this ItemMeta.
72  *
73  * @param ench enchantment to test
74  * @return true if the enchantment conflicts, false otherwise
75  */
77 
78  EnchantmentStorageMeta clone();
79 }
Map< Enchantment, Integer > getStoredEnchants()
boolean hasConflictingStoredEnchant(Enchantment ench)
boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction)