11package dev .drawethree .xprison .api .enchants ;
22
33import dev .drawethree .xprison .api .enchants .model .XPrisonEnchantment ;
4+ import org .bukkit .Location ;
45import org .bukkit .entity .Player ;
6+ import org .bukkit .event .block .BlockBreakEvent ;
57import org .bukkit .inventory .ItemStack ;
68
79import java .util .Map ;
810
911/**
10- * API interface for managing custom enchantments on items.
12+ * The {@code XPrisonEnchantsAPI} interface defines methods for interacting with and managing
13+ * custom enchantments in the XPrison plugin. It provides utilities to query, modify, register,
14+ * and remove custom enchantments on {@link ItemStack} objects as well as control enchantment-related
15+ * behavior during block-breaking events.
16+ *
17+ * <p>This API is intended for developers who wish to interact with the XPrison enchantment system.
1118 */
1219public interface XPrisonEnchantsAPI {
1320
1421 /**
1522 * Retrieves all custom enchantments applied to a specific item.
1623 *
17- * @param itemStack The item to check.
24+ * @param itemStack The item to check for enchantments .
1825 * @return A map of {@link XPrisonEnchantment} to their respective levels on the item.
1926 */
2027 Map <XPrisonEnchantment , Integer > getEnchants (ItemStack itemStack );
2128
2229 /**
23- * Checks if an item has a specific enchantment.
30+ * Checks if an item has a specific enchantment applied .
2431 *
2532 * @param item The item to check.
2633 * @param enchantment The enchantment to look for.
27- * @return True if the item has the specified enchantment, false otherwise.
34+ * @return {@code true} if the item has the specified enchantment, {@code false} otherwise.
2835 */
2936 boolean hasEnchant (ItemStack item , XPrisonEnchantment enchantment );
3037
@@ -33,71 +40,86 @@ public interface XPrisonEnchantsAPI {
3340 *
3441 * @param item The item to check.
3542 * @param enchantment The enchantment to look for.
36- * @param level The specific enchantment level.
37- * @return True if the item has the specified enchantment at the given level, false otherwise.
43+ * @param level The required level of the enchantment .
44+ * @return {@code true} if the item has the specified enchantment at the given level, {@code false} otherwise.
3845 */
3946 boolean hasEnchant (ItemStack item , XPrisonEnchantment enchantment , int level );
4047
4148 /**
4249 * Gets the level of a specific enchantment on an item.
4350 *
44- * @param item The item to check .
45- * @param enchantment The enchantment to retrieve the level for .
46- * @return The level of the enchantment, or 0 if the enchantment is not present.
51+ * @param item The item to inspect .
52+ * @param enchantment The enchantment whose level is to be retrieved .
53+ * @return The level of the enchantment, or {@code 0} if not present.
4754 */
4855 int getEnchantLevel (ItemStack item , XPrisonEnchantment enchantment );
4956
5057 /**
51- * Sets an enchantment with a specific level on an item.
58+ * Sets or updates a specific enchantment with a defined level on an item.
5259 *
5360 * @param player The player applying the enchantment.
54- * @param item The item to enchant .
61+ * @param item The item to be enchanted .
5562 * @param enchantment The enchantment to apply.
56- * @param level The level of the enchantment .
57- * @return The modified item with the enchantment applied.
63+ * @param level The level to set .
64+ * @return The modified {@link ItemStack} with the enchantment applied.
5865 */
5966 ItemStack setEnchantLevel (Player player , ItemStack item , XPrisonEnchantment enchantment , int level );
6067
6168 /**
6269 * Removes a specific enchantment from an item.
6370 *
64- * @param player The player removing the enchantment .
71+ * @param player The player performing the removal .
6572 * @param item The item to modify.
6673 * @param enchantment The enchantment to remove.
67- * @return The modified item with the enchantment removed.
74+ * @return The modified {@link ItemStack} with the enchantment removed.
6875 */
6976 ItemStack removeEnchant (Player player , ItemStack item , XPrisonEnchantment enchantment );
7077
7178 /**
72- * Retrieves an enchantment by its ID.
79+ * Retrieves a custom enchantment by its internal ID.
7380 *
74- * @param id The ID of the enchantment.
75- * @return The {@link XPrisonEnchantment} corresponding to the ID , or null if not found.
81+ * @param id The unique ID of the enchantment.
82+ * @return The corresponding {@link XPrisonEnchantment}, or {@code null} if not found.
7683 */
7784 XPrisonEnchantment getById (int id );
7885
7986 /**
80- * Retrieves an enchantment by its raw name.
87+ * Retrieves a custom enchantment by its raw (unformatted) name.
8188 *
8289 * @param rawName The raw name of the enchantment.
83- * @return The {@link XPrisonEnchantment} corresponding to the name , or null if not found.
90+ * @return The corresponding {@link XPrisonEnchantment}, or {@code null} if not found.
8491 */
8592 XPrisonEnchantment getByName (String rawName );
8693
8794 /**
88- * Registers a new custom enchantment.
95+ * Registers a new custom enchantment to the system .
8996 *
9097 * @param enchantment The enchantment to register.
91- * @return True if the enchantment was registered successfully, false otherwise.
98+ * @return {@code true} if registration was successful, {@code false} otherwise.
9299 */
93100 boolean registerEnchant (XPrisonEnchantment enchantment );
94101
95102 /**
96103 * Unregisters an existing custom enchantment.
97104 *
98105 * @param enchantment The enchantment to unregister.
99- * @return True if the enchantment was unregistered successfully, false otherwise.
106+ * @return {@code true} if unregistration was successful, {@code false} otherwise.
100107 */
101108 boolean unregisterEnchant (XPrisonEnchantment enchantment );
102109
110+ /**
111+ * Prevents the specified {@link BlockBreakEvent} from triggering any enchantment logic.
112+ * Useful for temporary suppression of enchantment effects.
113+ *
114+ * @param event The block break event to ignore.
115+ */
116+ void ignoreBlockBreakEvent (BlockBreakEvent event );
117+
118+ /**
119+ * Checks whether enchantments are allowed at a given {@link Location}.
120+ *
121+ * @param location The location to check.
122+ * @return {@code true} if enchantments are allowed, {@code false} otherwise.
123+ */
124+ boolean isEnchantAllowed (Location location );
103125}
0 commit comments