Cuberite Forum
"Chest window" menus - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: "Chest window" menus (/thread-2481.html)



"Chest window" menus - newobj - 07-23-2016

High level problem:

I'm trying to make a Chest window-based menu, like one you'd see one many servers like Mineplex/Hypixel for choosing mini-games, etc. I have a simple OnSlotChanged callback that handles someone clicking on an item in the Chest window. When someone clicks on the item, I run a command, and close the window.

The problem is, when they click, the item is picked up (equipped), and when the window closes, Cuberite seems to toss the item away out onto the ground. So that's really bad for what I'm trying to do.

Has anyone implemented a menu like this in Cuberite before?  I'm not super familiar with the Minecraft protocol so I don't know how Spigot/Bukkit based servers accomplish this, ... so I have to guess at what the solution is:

1) Unequip the Player's item in OnSlotChanged? I don't see any API for this.
2) Entirely delete/remove the equipped item? Still don't see an API for this.
3) Make the chest items non-equippable?
4) Change Cuberite so it doesn't toss equipped items when a Chest window is closed?

Can anyone help with this?

Thanks!
Brian


RE: "Chest window" menus - NiLSPACE - 07-23-2016

A long time ago I ran into this problem as well. I don think itś fixed yet: https://github.com/cuberite/cuberite/issues/813