Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 0dc0c59

Browse files
committed
Refactor button handler to use method reference for click actions in NavigationBar
1 parent 582c184 commit 0dc0c59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/gg/nextforge/ui/inventory/NavigationBar.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package gg.nextforge.ui.inventory;
22

3+
import gg.nextforge.ui.action.ClickAction;
34
import gg.nextforge.ui.component.UIButton;
45
import gg.nextforge.ui.component.UIComponent;
56
import org.bukkit.Material;
@@ -20,17 +21,17 @@ public class NavigationBar {
2021
private final Map<Integer, UIComponent> buttons = new HashMap<>();
2122

2223
public NavigationBar backButton(int slot, BiConsumer<Player, ClickType> handler) {
23-
buttons.put(slot, new UIButton(() -> createItem(Material.ARROW, "§cBack"), handler));
24+
buttons.put(slot, new UIButton(() -> createItem(Material.ARROW, "§cBack"), handler::accept));
2425
return this;
2526
}
2627

2728
public NavigationBar nextButton(int slot, BiConsumer<Player, ClickType> handler) {
28-
buttons.put(slot, new UIButton(() -> createItem(Material.ARROW, "§aNext"), handler));
29+
buttons.put(slot, new UIButton(() -> createItem(Material.ARROW, "§aNext"), handler::accept));
2930
return this;
3031
}
3132

3233
public NavigationBar closeButton(int slot, BiConsumer<Player, ClickType> handler) {
33-
buttons.put(slot, new UIButton(() -> createItem(Material.BARRIER, "§4Close"), handler));
34+
buttons.put(slot, new UIButton(() -> createItem(Material.BARRIER, "§4Close"), handler::accept));
3435
return this;
3536
}
3637

0 commit comments

Comments
 (0)