Skip to content

Commit 7c8cd8a

Browse files
committed
Merge remote-tracking branch 'main/master'
2 parents bcfb5ca + 0d6a997 commit 7c8cd8a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Labyrinth.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
2929
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.10.6" level="project" />
3030
<orderEntry type="library" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
31+
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
3132
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
3233
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
3334
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />

src/main/java/com/github/sanctum/labyrinth/gui/menuman/MenuBuilder.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import java.util.HashMap;
2727
import java.util.Map;
28+
import java.util.function.Supplier;
2829

2930
/**
3031
* Fluid interface menu builder
@@ -208,6 +209,18 @@ public ElementBuilder addElement(ItemStack item) {
208209
return new ElementBuilder(this, new MenuElement(item));
209210
}
210211

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+
211224
/**
212225
* Add an ItemStack to the menu of specified display name and lore.
213226
* <p>
@@ -233,14 +246,24 @@ public FillerBuilder setFiller(ItemStack item) {
233246
return new FillerBuilder(this, new MenuElement(item));
234247
}
235248

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+
236259
/**
237260
* Fill the remaining slots of the menu with an ItemStack
238261
* of specified display name and lore.
239262
*
240263
* @param item item to add
241264
* @param text display name of item
242265
* @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
244267
*/
245268
public FillerBuilder setFiller(ItemStack item, String text, String... lore) {
246269
return new FillerBuilder(this, new MenuElement(item, text, lore));

0 commit comments

Comments
 (0)