Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click.closeForPlayer(): Container is not available in current context [Bukkit 1.8.9] #651

Open
2 of 4 tasks
sqlongithub opened this issue Mar 5, 2024 · 1 comment
Open
2 of 4 tasks
Assignees
Labels
bug Something isn't working

Comments

@sqlongithub
Copy link

Is there an existing issue for this?

  • 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

  1. Compile the latest version of inventory-framework from github, and include it in your project
  2. Create a View
  3. In onInit() define a Layout for the View
  4. In onFirstRender(RenderContext render), render an item in the Layout with
render.layoutSlot('A').withItem(new ItemStack(Material.STICK)).onClick(click -> {
    click.setCancelled(true);
    click.closeForPlayer();
}).cancelOnClick();
  1. Open the GUI somehow
  2. Click on an item that is rendered as layoutSlot A
  3. Check the server console or logs

💻 Platform

  • Bukkit
  • Sponge
  • Other

⭐ Server Version

1.8.9

📚 Library Version

v3.1.0-rc (compiled from github)

✍️ Additional context

No response

@sqlongithub sqlongithub added the bug Something isn't working label Mar 5, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Inventory Framework Mar 5, 2024
@DevNatan DevNatan moved this from 📋 Backlog to 🏗 In progress in Inventory Framework Mar 5, 2024
@DevNatan
Copy link
Owner

Thx!! Working on it 🤙🏽

@DevNatan DevNatan self-assigned this Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants