inventory-framework icon indicating copy to clipboard operation
inventory-framework copied to clipboard

Doubt

Open kaiquyricardo opened this issue 1 year ago • 5 comments

I'm unsure about opening the menu because it's not opening

` private final ViewFrame viewFrame = ViewFrame.create(this);

public void registerViews(View... views) {
    viewFrame.register(views);
}

` public class RewardsView extends View {

private final OnlineTimePlugin plugin;
private final State<UserCache> userCacheState = initialState("userCache");

private final State<Pagination> paginationState = lazyPaginationState(
        (context) -> rewardList(),
        (context, item, index, reward) -> {
            final UserCache uCache = userCacheState.get(context);
            final User user = uCache.getByUser(context.getPlayer().getName());

            item.onRender(rewardItem -> rewardItem.setItem(new ItemBuilder(Material.SKULL_ITEM)
                    .texture(!user.canCollect(reward) || user.getRewards().contains(reward.getId()) ? "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2VkMWFiYTczZjYzOWY0YmM0MmJkNDgxOTZjNzE1MTk3YmUyNzEyYzNiOTYyYzk3ZWJmOWU5ZWQ4ZWZhMDI1In19fQ==" : reward.getTexture())
                    .name(reward.getName())
                    .lore(reward.getLore())
                    .build())
            ).onClick(click -> {
              
            });
        }
);



@Override
public void onInit(@NotNull ViewConfigBuilder config) {
    config.title("Tempo online")
            .size(5)
            .scheduleUpdate(20L)
            .layout(
                    "         ",
                    "         ",
                    " OOOOOOO ",
                    " OOOOOOO ",
                    "         "
            )
            .cancelOnPickup()
            .cancelOnDrag()
            .cancelOnClick()
            .cancelOnDrop()
            .build();
}


public List<Reward> rewardList() {
    final RewardsCache rCache = plugin.getRewardsCache();

    return rCache.getCachedElements();
}

`

`

kaiquyricardo avatar May 03 '24 02:05 kaiquyricardo

Are you using the correct version?

ViewFrame creation:

final ViewFrame viewFrame = ViewFrame.create(this)
            .with(/*new ExampleView()*/)
            .register()

https://github.com/DevNatan/inventory-framework/wiki/Basic-Usage#registering-our-views

luapascoal avatar May 04 '24 00:05 luapascoal

Nah the latest version is still very unstable and has a lot of errors. Stable one was 3.0.8.

ch4ika avatar May 04 '24 01:05 ch4ika

Nah the latest version is still very unstable and has a lot of errors. Stable one was 3.0.8.

Yeah, I know.

luapascoal avatar May 04 '24 02:05 luapascoal

Nah the latest version is still very unstable and has a lot of errors. Stable one was 3.0.8.

I was using 3.0.8, but when using something to execute on the console, such as gaining just one block of stone, the player ends up receiving 2

kaiquyricardo avatar May 04 '24 12:05 kaiquyricardo

Nah the latest version is still very unstable and has a lot of errors. Stable one was 3.0.8.

I was using 3.0.8, but when using something to execute on the console, such as gaining just one block of stone, the player ends up receiving 2

It's not an IF problem.

luapascoal avatar May 05 '24 07:05 luapascoal