Skip to content

Problem With FillBorders #220

Description

@Challangerson

The code
public class AuctionsInventory implements InventoryProvider {

private final UserEngine userEngine;
private final ItemsEngine itemsEngine;
private final SmartInventory inventory;

public AuctionsInventory(UserEngine userEngine, ItemsEngine itemsEngine) {
    this.userEngine = userEngine;
    this.itemsEngine = itemsEngine;
    this.inventory = SmartInventory.builder()
            .id("myInventory")
            .provider(this)
            .size(6, 9)
            .title(ChatUtil.fixColor("&6&lMARKET"))
            .build();
}

@Override
public void init(Player player, InventoryContents inventoryContents) {
    Pagination pagination = inventoryContents.pagination();

    ClickableItem[] items = new ClickableItem[50];
    for(int i = 0; i < 50; i++)
        items[i] = ClickableItem.empty(new ItemStack(Material.CARROT_ITEM));

    pagination.setItems(items);
    pagination.setItemsPerPage(28);
    
    inventoryContents.fillBorders(ClickableItem.empty(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 15).toItemStack()));
    pagination.addToIterator(inventoryContents.newIterator(SlotIterator.Type.HORIZONTAL, SlotPos.of(1,1 )));
    inventoryContents.set(5,3,ClickableItem.of(
            new ItemBuilder(Material.ARROW).setName("&fPoprzednia Strona").toItemStack(),
            event -> this.inventory.open(player, pagination.previous().getPage())));

    inventoryContents.set(5,4, ClickableItem.empty(
            new ItemBuilder(Material.CAULDRON).setName("&7INFORMACJE")
            .setLore(Arrays.asList("","")).toItemStack()));

    inventoryContents.set(5,5,ClickableItem.of(
            new ItemBuilder(Material.ARROW).setName("&fNastępna Strona").toItemStack(),
            event -> this.inventory.open(player, pagination.next().getPage())));


}

@Override
public void update(Player player, InventoryContents inventoryContents) {
    
}

public SmartInventory getInventory() {
    return this.inventory;
}

}

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions