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