|
13 | 13 | public class ItemAPI { |
14 | 14 |
|
15 | 15 | private final int slot; |
16 | | - private final Function<Object, ItemStack> function; |
| 16 | + private Function<Object, ItemStack> function; |
17 | 17 | private ItemStack item; |
18 | | - private final boolean cancelled; |
19 | | - private final Consumer<InventoryClickEvent> consumer; |
| 18 | + private boolean cancelled; |
| 19 | + private Consumer<InventoryClickEvent> consumer; |
20 | 20 |
|
21 | 21 | /** |
22 | 22 | * @param slot The slot where will be located the item. |
@@ -92,4 +92,36 @@ public boolean isCancelled() { |
92 | 92 | public Consumer<InventoryClickEvent> getConsumer() { |
93 | 93 | return this.consumer; |
94 | 94 | } |
| 95 | + |
| 96 | + /** |
| 97 | + * Change the function that create the ItemStack of the ItemAPI. |
| 98 | + * @param function the function. |
| 99 | + */ |
| 100 | + public void setFunction(final Function<Object, ItemStack> function) { |
| 101 | + this.function = function; |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * Change the item of the ItemAPI. |
| 106 | + * @param item the new item. |
| 107 | + */ |
| 108 | + public void setItem(final ItemStack item) { |
| 109 | + this.item = item; |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * Change id the interaction is cancelled. |
| 114 | + * @param cancelled is the interaction cancelled. |
| 115 | + */ |
| 116 | + public void setCancelled(final boolean cancelled) { |
| 117 | + this.cancelled = cancelled; |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Change the consumer of the ItemAPI. |
| 122 | + * @param consumer the consumer to execute. |
| 123 | + */ |
| 124 | + public void setConsumer(final Consumer<InventoryClickEvent> consumer) { |
| 125 | + this.consumer = consumer; |
| 126 | + } |
95 | 127 | } |
0 commit comments