|
10 | 10 |
|
11 | 11 | import org.jetbrains.annotations.NotNull;
|
12 | 12 | import org.jetbrains.annotations.Nullable;
|
13 |
| -import org.jetbrains.annotations.Unmodifiable; |
14 | 13 |
|
15 | 14 | import java.time.Duration;
|
16 | 15 | import java.util.*;
|
17 | 16 | import java.util.function.Predicate;
|
18 | 17 | import java.util.stream.Stream;
|
19 | 18 |
|
20 | 19 | @SuppressWarnings({"unused", "UnusedReturnValue"})
|
21 |
| -public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, InventoryHolder { |
| 20 | +public interface IMenu extends Iterable<MenuItem>, InventoryHolder { |
22 | 21 | /**
|
23 | 22 | * Get a LIST iterator of the items in the menu
|
24 | 23 | * @return the list iterator
|
@@ -61,48 +60,42 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
|
61 | 60 | /**
|
62 | 61 | * Add a list of items to the list of items in the menu.
|
63 | 62 | * @param items varargs of itemStack stacks
|
64 |
| - * @return the object for chaining |
65 | 63 | */
|
66 |
| - M addItem(@NotNull final ItemStack... items); |
| 64 | + void addItem(@NotNull final ItemStack... items); |
67 | 65 |
|
68 | 66 | /**
|
69 | 67 | * Add a list of items to the list of items in the menu.
|
70 | 68 | * @param items the items
|
71 |
| - * @return the object for chaining |
72 | 69 | */
|
73 |
| - M addItem(@NotNull final MenuItem... items); |
| 70 | + void addItem(@NotNull final MenuItem... items); |
74 | 71 |
|
75 | 72 | /**
|
76 | 73 | * Add the itemStack to the list of items in the menu.
|
77 | 74 | * <p>
|
78 | 75 | * As this is the itemStack to add, it's not a menu itemStack, so it'd be converted to a MenuItem first
|
79 | 76 | * @param item the itemStack to add
|
80 |
| - * @return the object for chaining |
81 | 77 | */
|
82 |
| - M setItem(@NotNull Slot slot, ItemStack item); |
| 78 | + void setItem(@NotNull Slot slot, ItemStack item); |
83 | 79 |
|
84 | 80 | /**
|
85 | 81 | * Add the itemStack to the list of items in the menu.
|
86 | 82 | * @param item the itemStack to add
|
87 |
| - * @return the object for chaining |
88 | 83 | */
|
89 |
| - M setItem(@NotNull Slot slot, MenuItem item); |
| 84 | + void setItem(@NotNull Slot slot, MenuItem item); |
90 | 85 |
|
91 | 86 | /**
|
92 | 87 | * Add the itemStack to the list of items in the menu.
|
93 | 88 | * <p>
|
94 | 89 | * As this is the itemStack to add, it's not a menu itemStack, so it'd be converted to a MenuItem first
|
95 | 90 | * @param item the itemStack to add
|
96 |
| - * @return the object for chaining |
97 | 91 | */
|
98 |
| - M setItem(int slot, ItemStack item); |
| 92 | + void setItem(int slot, ItemStack item); |
99 | 93 |
|
100 | 94 | /**
|
101 | 95 | * Add the itemStack to the list of items in the menu.
|
102 | 96 | * @param item the itemStack to add
|
103 |
| - * @return the object for chaining |
104 | 97 | */
|
105 |
| - M setItem(int slot, MenuItem item); |
| 98 | + void setItem(int slot, MenuItem item); |
106 | 99 |
|
107 | 100 | /**
|
108 | 101 | * get the itemStack from the list of items in the menu.
|
@@ -186,36 +179,31 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
|
186 | 179 | /**
|
187 | 180 | * Remove all the specified items from the inventory.
|
188 | 181 | * @param itemStacks the items to remove
|
189 |
| - * @return the object for chaining |
190 | 182 | */
|
191 |
| - M removeItem(@NotNull final ItemStack... itemStacks); |
| 183 | + void removeItem(@NotNull final ItemStack... itemStacks); |
192 | 184 |
|
193 | 185 | /**
|
194 | 186 | * Remove all the specified items from the inventory.
|
195 | 187 | * @param itemStacks the items to remove
|
196 |
| - * @return the object for chaining |
197 | 188 | */
|
198 |
| - M removeItemStacks(@NotNull final List<ItemStack> itemStacks); |
| 189 | + void removeItemStacks(@NotNull final List<ItemStack> itemStacks); |
199 | 190 |
|
200 | 191 | /**
|
201 | 192 | * Remove all the specified items from the inventory.
|
202 | 193 | * @param itemStacks the items to remove
|
203 |
| - * @return the object for chaining |
204 | 194 | */
|
205 |
| - M removeItem(@NotNull final MenuItem... itemStacks); |
| 195 | + void removeItem(@NotNull final MenuItem... itemStacks); |
206 | 196 |
|
207 | 197 | /**
|
208 | 198 | * Remove all the specified items from the inventory.
|
209 | 199 | * @param itemStacks the items to remove
|
210 |
| - * @return the object for chaining |
211 | 200 | */
|
212 |
| - M removeItem(@NotNull final List<MenuItem> itemStacks); |
| 201 | + void removeItem(@NotNull final List<MenuItem> itemStacks); |
213 | 202 |
|
214 | 203 | /**
|
215 | 204 | * Update the inventory which recreates the items on default
|
216 |
| - * @return the object for chaining |
217 | 205 | */
|
218 |
| - M update(); |
| 206 | + void update(); |
219 | 207 |
|
220 | 208 | /**
|
221 | 209 | * Updates the menu every X ticks (repeatTime)
|
@@ -250,17 +238,15 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
|
250 | 238 | /**
|
251 | 239 | * Update the inventory with the title (RE-OPENS THE INVENTORY)
|
252 | 240 | * @param title the new title
|
253 |
| - * @return the object for chaining |
254 | 241 | */
|
255 |
| - M updateTitle(String title); |
| 242 | + void updateTitle(String title); |
256 | 243 |
|
257 | 244 | /**
|
258 | 245 | * Open the inventory for the provided player.
|
259 | 246 | * @apiNote Will not work if the player is sleeping.
|
260 | 247 | * @param entity the provided entity to open the inventory for.
|
261 |
| - * @return the object for chaining |
262 | 248 | */
|
263 |
| - M open(@NotNull HumanEntity entity); |
| 249 | + void open(@NotNull HumanEntity entity); |
264 | 250 |
|
265 | 251 | boolean addModifier(Modifier modifier);
|
266 | 252 |
|
@@ -288,22 +274,5 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
|
288 | 274 | */
|
289 | 275 | void updateItem(@NotNull Slot slot, @NotNull final ItemStack itemStack);
|
290 | 276 |
|
291 |
| - |
292 |
| - /** |
293 |
| - * Alternative {@link #updateItem(int, ItemStack)} that takes <i>ROWS</i> and <i>COLUMNS</i> instead of slots. also using MenuItem |
294 |
| - * |
295 |
| - * @param slot The row and col of the slot. |
296 |
| - * @param itemStack The {@link ItemStack} to replace in the original one in the {@link MenuItem}. |
297 |
| - */ |
298 |
| - void updateItem(@NotNull Slot slot, @NotNull final MenuItem itemStack); |
299 |
| - |
300 |
| - /** |
301 |
| - * get the map of items in the menu |
302 |
| - * <p>The returned map is unmodifiable; {@link UnsupportedOperationException} is thrown when attempting to modify it</p> |
303 |
| - * @return the map of items in the menu which is unmodifiable |
304 |
| - */ |
305 |
| - @NotNull |
306 |
| - @Unmodifiable Map<Integer, MenuItem> getItemMap(); |
307 |
| - |
308 | 277 | void clear();
|
309 | 278 | }
|
0 commit comments