Skip to content

Direct item update by updateItem not workingΒ #223

Description

@devnatan

Is there an existing issue for this?

  • I have searched the existing issues

πŸ› Describe the bug

slot(8, new ItemStack(Material.getMaterial("REDSTONE")))
    .cancelOnClick()
    .onUpdate(update -> update.updateItem(wrapper -> wrapper.asBukkitItem().setAmount(update.paginated().getPage())));

An exception being thrown because wrapper is null even with fallback item.

βœ”οΈ Expected behavior

It was expected that the item that was rendered would be updated when the slot is updated, but instead an exception is being thrown.

πŸ‘£ Steps to Reproduce

No response

πŸ’» Platform

  • Bukkit
  • Sponge
  • Other

⭐ Versions

IF v2.5.4-beta

✍️ Additional context

Failed to execute click pipeline
java.lang.NullPointerException: Cannot invoke "me.saiintbrisson.minecraft.ItemWrapper.asBukkitItem()" because "wrapper" is null
        at me.saiintbrisson.minecraft.Test2.lambda$new$1(InventoryFramework.java:40) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.AbstractViewSlotContext.updateItem(AbstractViewSlotContext.java:128) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.Test2.lambda$new$2(InventoryFramework.java:40) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.AbstractView.lambda$update$4(AbstractView.java:771) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.AbstractVirtualView.runCatching(AbstractVirtualView.java:383) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.AbstractView.update(AbstractView.java:771) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.pipeline.interceptors.UpdateInterceptor.intercept(UpdateInterceptor.java:39) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.pipeline.interceptors.UpdateInterceptor.intercept(UpdateInterceptor.java:14) ~[inventory-framework-2.5.4-beta-all.jar:?]

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions