inventory-framework
inventory-framework copied to clipboard
click.closeForPlayer(): Container is not available in current context [Bukkit 1.8.9]
Is there an existing issue for this?
- [X] I have searched the existing issues
🐛 Describe the bug
When rendering a (layout) item with .withItem(), and setting an onClick handler with .onClick(click -> {}), closing the inventory with click.closeForPlayer() throws an exception with the message:
Container is not available in the current context: some.package.inventoryframework.context.SlotClickContext
at some.package.inventoryframework.context.PlatformContext.getContainerOrThrow(PlatformContext.java:111)
I'm not sure if this is because of layouts, but I wouldn't assume so.
✔️ Expected behavior
The inventory should close normally.
👣 Steps to Reproduce
- Compile the latest version of inventory-framework from github, and include it in your project
- Create a
View - In
onInit()define aLayoutfor theView - In
onFirstRender(RenderContext render), render an item in theLayoutwith
render.layoutSlot('A').withItem(new ItemStack(Material.STICK)).onClick(click -> {
click.setCancelled(true);
click.closeForPlayer();
}).cancelOnClick();
- Open the GUI somehow
- Click on an item that is rendered as layoutSlot
A - Check the server console or logs
💻 Platform
- [X] Bukkit
- [ ] Sponge
- [ ] Other
⭐ Server Version
1.8.9
📚 Library Version
v3.1.0-rc (compiled from github)
✍️ Additional context
No response
Thx!! Working on it 🤙🏽