diff --git a/NookureInventory-Test/src/main/java/com/nookure/core/inv/Main.java b/NookureInventory-Test/src/main/java/com/nookure/core/inv/Main.java index 8b31ce0..7f57a6d 100644 --- a/NookureInventory-Test/src/main/java/com/nookure/core/inv/Main.java +++ b/NookureInventory-Test/src/main/java/com/nookure/core/inv/Main.java @@ -25,6 +25,7 @@ public void onEnable() { saveResource("gui/GuiLayoutTest.xml", false); saveResource("gui/PaginationTest.peb", true); saveResource("gui/PaginationCommon.peb", true); + saveResource("gui/PlayerPaginationTest.peb", true); engine = new PaperNookureInventoryEngine.Builder() .templateFolder("gui") @@ -47,6 +48,13 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab return true; } + if (args.length > 0 && args[0].equals("players")) { + List players = new ArrayList<>(Bukkit.getOnlinePlayers()); + + engine.openAsync(player, "PlayerPaginationTest.peb", "players", players, "page", 1, "player", player); + return true; + } + engine.openAsync(player, "GuiLayoutTest.xml"); } return true; diff --git a/NookureInventory-Test/src/main/resources/gui/PlayerPaginationTest.peb b/NookureInventory-Test/src/main/resources/gui/PlayerPaginationTest.peb new file mode 100644 index 0000000..2f0eedd --- /dev/null +++ b/NookureInventory-Test/src/main/resources/gui/PlayerPaginationTest.peb @@ -0,0 +1,47 @@ +{# @pebvariable name="page" type="java.lang.Integer" #} +{# @pebvariable name="pagination" type="com.nookure.core.inv.template.extension.PaginationItemExtension.PaginationData" #} +{# @pebvariable name="players" type="java.util.List" #} +{# @pebvariable name="player" type="org.bukkit.entity.Player" #} +{% import "PaginationCommon.peb" %} + + + + [#F5A9C1]Players[#F5A9C1] >> [green]Page {{ page }}[/green] + + 6 + + + {% set pag = pagination(9, 5, page, players.size) %} + {% for i in range(pag.start, pag.end, 1) %} + {% set player = players[i] %} + {% set slot = i - pag.start %} + + + [red]{{ player.name }}[/red] + + + + [red]Magic Stone [/red] + + + [blue]Line 2[/blue] + + + + + + + + {% endfor %} + {{ paginationFooter(48, 50, page, pag) }} + + \ No newline at end of file