Skip to content

check if there is an item in the layout and if not, set a barrier #656

@kaiquyricardo

Description

@kaiquyricardo

I wanted to know if it is possible to check if there is an item in the layout and if not, define a barrier

`

private final State<Pagination> paginationState = lazyPaginationState(
        (context) -> getBosses(),
        (context, item, index, bossType) -> item.withItem(
                new ItemBuilder(bossType.getIcon().clone())
                        .amount(1)
                        .lore(
                                "§7Está área de bosses tem",
                                "§7o nível para este boss.",
                                "",
                                " §fVida: §c❤" + NumberFormatter.format(bossType.getLife()),
                                "  §7#" + bossType.getRewards().size() + " recompensas.",
                                "",
                                "§eClique para ver as recompensas."
                        ).build()
        ).onClick(click -> click.openForPlayer(RewardsView.class,
                ImmutableMap.of("boss_type", bossType))));

@Override
public void onInit(@NotNull ViewConfigBuilder config) {
    config.cancelOnPickup()
            .size(6)
            .title("Área de boss")
            .cancelOnDrag()
            .cancelOnClick()
            .cancelOnDrop()
            .layout(
                    "         ",
                    "  OOO    ",
                    "  OOO    ",
                    "         ",
                    "         ",
                    "         "
            );
}


@Override
public void onFirstRender(@NotNull RenderContext render) {
    final Pagination pagination = paginationState.get(render);

 // verify not has item in pagination
 
 -> BARRIER ITEM
 


}

public List<BossType> getBosses() {
    return plugin.getBossTypeCache().getCachedElements();
}

}

`

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