Search in sources :

Example 1 with ControlPane

use of com.cyr1en.commandprompter.prompt.ui.inventory.ControlPane in project CommandPrompter by CyR1en.

the class PlayerUIPrompt method sendPrompt.

@Override
public void sendPrompt() {
    gui.setOnClose(e -> getPromptManager().cancel(getContext().getSender()));
    var p = (Player) getContext().getSender();
    var skullPane = new PaginatedPane(0, 0, 9, size - 1);
    var isSorted = getPlugin().getPromptConfig().sorted();
    var isPerWorld = getPlugin().getPromptConfig().isPerWorld();
    var skulls = isPerWorld ? (isSorted ? SkullCache.getSkullsSortedFor(p.getWorld().getPlayers()) : SkullCache.getSkullsFor(p.getWorld().getPlayers())) : (isSorted ? SkullCache.getSkullsSorted() : SkullCache.getSkulls());
    skullPane.populateWithItemStacks(skulls);
    skullPane.setOnClick(this::processClick);
    gui.addPane(skullPane);
    gui.addPane(new ControlPane(getPlugin(), skullPane, gui, getContext(), size));
    gui.show((HumanEntity) getContext().getSender());
}
Also used : Player(org.bukkit.entity.Player) PaginatedPane(com.github.stefvanschie.inventoryframework.pane.PaginatedPane) ControlPane(com.cyr1en.commandprompter.prompt.ui.inventory.ControlPane)

Aggregations

ControlPane (com.cyr1en.commandprompter.prompt.ui.inventory.ControlPane)1 PaginatedPane (com.github.stefvanschie.inventoryframework.pane.PaginatedPane)1 Player (org.bukkit.entity.Player)1