25
25
26
26
import java .util .HashMap ;
27
27
import java .util .Map ;
28
+ import java .util .function .Supplier ;
28
29
29
30
/**
30
31
* Fluid interface menu builder
@@ -208,6 +209,18 @@ public ElementBuilder addElement(ItemStack item) {
208
209
return new ElementBuilder (this , new MenuElement (item ));
209
210
}
210
211
212
+ /**
213
+ * Add a previously-styled ItemStack directly to the menu via Supplier.
214
+ * <p>
215
+ * This is useful if you're used to creating your own custom items.
216
+ *
217
+ * @param supplier supplier of item to add
218
+ * @return a new ElementBuilder to customize the element
219
+ */
220
+ public ElementBuilder addElement (@ NotNull Supplier <ItemStack > supplier ) {
221
+ return new ElementBuilder (this , new MenuElement (supplier .get ()));
222
+ }
223
+
211
224
/**
212
225
* Add an ItemStack to the menu of specified display name and lore.
213
226
* <p>
@@ -233,14 +246,24 @@ public FillerBuilder setFiller(ItemStack item) {
233
246
return new FillerBuilder (this , new MenuElement (item ));
234
247
}
235
248
249
+ /**
250
+ * Fill the remaining slots of the menu with an ItemStack via Supplier.
251
+ *
252
+ * @param supplier supplier of item to add
253
+ * @return a new FillerBuilder to customize the element
254
+ */
255
+ public FillerBuilder setFiller (@ NotNull Supplier <ItemStack > supplier ) {
256
+ return new FillerBuilder (this , new MenuElement (supplier .get ()));
257
+ }
258
+
236
259
/**
237
260
* Fill the remaining slots of the menu with an ItemStack
238
261
* of specified display name and lore.
239
262
*
240
263
* @param item item to add
241
264
* @param text display name of item
242
265
* @param lore optional lore to add as varargs
243
- * @return a new ElementBuilder to customize the element
266
+ * @return a new FillerBuilder to customize the element
244
267
*/
245
268
public FillerBuilder setFiller (ItemStack item , String text , String ... lore ) {
246
269
return new FillerBuilder (this , new MenuElement (item , text , lore ));
0 commit comments