Skip to content

Commit 2666619

Browse files
added the PaginatedInventoryBuilder#setReplacementActionByCustomData(String, Object, ClickAction) method
1 parent fcfc862 commit 2666619

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/src/main/java/com/wizardlybump17/wlib/inventory/paginated/PaginatedInventoryBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.wizardlybump17.wlib.inventory.CustomInventory;
44
import com.wizardlybump17.wlib.inventory.CustomInventoryHolder;
5+
import com.wizardlybump17.wlib.inventory.item.ClickAction;
56
import com.wizardlybump17.wlib.inventory.item.InventoryNavigator;
67
import com.wizardlybump17.wlib.inventory.item.ItemButton;
78
import com.wizardlybump17.wlib.inventory.listener.InventoryListener;
@@ -104,6 +105,14 @@ public PaginatedInventoryBuilder shapeReplacements(@NonNull Map<Character, ItemB
104105
return this;
105106
}
106107

108+
public @NotNull PaginatedInventoryBuilder setReplacementActionByCustomData(@NotNull String key, @Nullable Object value, @NotNull ClickAction action) {
109+
for (ItemButton button : shapeReplacements.values()) {
110+
if (Objects.equals(button.getCustomData().get(key), value))
111+
button.setClickAction(action);
112+
}
113+
return this;
114+
}
115+
107116
public PaginatedInventoryBuilder content(@Nullable List<ItemButton> content) {
108117
this.content = content == null ? new ArrayList<>() : content;
109118
checkNullContent();

0 commit comments

Comments
 (0)