Skip to content

Commit d31bce4

Browse files
Methods & Changes
1 parent 1c21918 commit d31bce4

File tree

1 file changed

+14
-45
lines changed

1 file changed

+14
-45
lines changed

src/main/java/me/flame/menus/menu/IMenu.java

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
import org.jetbrains.annotations.NotNull;
1212
import org.jetbrains.annotations.Nullable;
13-
import org.jetbrains.annotations.Unmodifiable;
1413

1514
import java.time.Duration;
1615
import java.util.*;
1716
import java.util.function.Predicate;
1817
import java.util.stream.Stream;
1918

2019
@SuppressWarnings({"unused", "UnusedReturnValue"})
21-
public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, InventoryHolder {
20+
public interface IMenu extends Iterable<MenuItem>, InventoryHolder {
2221
/**
2322
* Get a LIST iterator of the items in the menu
2423
* @return the list iterator
@@ -61,48 +60,42 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
6160
/**
6261
* Add a list of items to the list of items in the menu.
6362
* @param items varargs of itemStack stacks
64-
* @return the object for chaining
6563
*/
66-
M addItem(@NotNull final ItemStack... items);
64+
void addItem(@NotNull final ItemStack... items);
6765

6866
/**
6967
* Add a list of items to the list of items in the menu.
7068
* @param items the items
71-
* @return the object for chaining
7269
*/
73-
M addItem(@NotNull final MenuItem... items);
70+
void addItem(@NotNull final MenuItem... items);
7471

7572
/**
7673
* Add the itemStack to the list of items in the menu.
7774
* <p>
7875
* As this is the itemStack to add, it's not a menu itemStack, so it'd be converted to a MenuItem first
7976
* @param item the itemStack to add
80-
* @return the object for chaining
8177
*/
82-
M setItem(@NotNull Slot slot, ItemStack item);
78+
void setItem(@NotNull Slot slot, ItemStack item);
8379

8480
/**
8581
* Add the itemStack to the list of items in the menu.
8682
* @param item the itemStack to add
87-
* @return the object for chaining
8883
*/
89-
M setItem(@NotNull Slot slot, MenuItem item);
84+
void setItem(@NotNull Slot slot, MenuItem item);
9085

9186
/**
9287
* Add the itemStack to the list of items in the menu.
9388
* <p>
9489
* As this is the itemStack to add, it's not a menu itemStack, so it'd be converted to a MenuItem first
9590
* @param item the itemStack to add
96-
* @return the object for chaining
9791
*/
98-
M setItem(int slot, ItemStack item);
92+
void setItem(int slot, ItemStack item);
9993

10094
/**
10195
* Add the itemStack to the list of items in the menu.
10296
* @param item the itemStack to add
103-
* @return the object for chaining
10497
*/
105-
M setItem(int slot, MenuItem item);
98+
void setItem(int slot, MenuItem item);
10699

107100
/**
108101
* 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
186179
/**
187180
* Remove all the specified items from the inventory.
188181
* @param itemStacks the items to remove
189-
* @return the object for chaining
190182
*/
191-
M removeItem(@NotNull final ItemStack... itemStacks);
183+
void removeItem(@NotNull final ItemStack... itemStacks);
192184

193185
/**
194186
* Remove all the specified items from the inventory.
195187
* @param itemStacks the items to remove
196-
* @return the object for chaining
197188
*/
198-
M removeItemStacks(@NotNull final List<ItemStack> itemStacks);
189+
void removeItemStacks(@NotNull final List<ItemStack> itemStacks);
199190

200191
/**
201192
* Remove all the specified items from the inventory.
202193
* @param itemStacks the items to remove
203-
* @return the object for chaining
204194
*/
205-
M removeItem(@NotNull final MenuItem... itemStacks);
195+
void removeItem(@NotNull final MenuItem... itemStacks);
206196

207197
/**
208198
* Remove all the specified items from the inventory.
209199
* @param itemStacks the items to remove
210-
* @return the object for chaining
211200
*/
212-
M removeItem(@NotNull final List<MenuItem> itemStacks);
201+
void removeItem(@NotNull final List<MenuItem> itemStacks);
213202

214203
/**
215204
* Update the inventory which recreates the items on default
216-
* @return the object for chaining
217205
*/
218-
M update();
206+
void update();
219207

220208
/**
221209
* Updates the menu every X ticks (repeatTime)
@@ -250,17 +238,15 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
250238
/**
251239
* Update the inventory with the title (RE-OPENS THE INVENTORY)
252240
* @param title the new title
253-
* @return the object for chaining
254241
*/
255-
M updateTitle(String title);
242+
void updateTitle(String title);
256243

257244
/**
258245
* Open the inventory for the provided player.
259246
* @apiNote Will not work if the player is sleeping.
260247
* @param entity the provided entity to open the inventory for.
261-
* @return the object for chaining
262248
*/
263-
M open(@NotNull HumanEntity entity);
249+
void open(@NotNull HumanEntity entity);
264250

265251
boolean addModifier(Modifier modifier);
266252

@@ -288,22 +274,5 @@ public interface IMenu<M extends IMenu<M>> extends Iterable<MenuItem>, Inventory
288274
*/
289275
void updateItem(@NotNull Slot slot, @NotNull final ItemStack itemStack);
290276

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-
308277
void clear();
309278
}

0 commit comments

Comments
 (0)