-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
What i mean is that when you open a container, and the players closes it and then the player tries to open another one you will always get this error: Error: Player already has a fake container assigned.
I even tried using PlayerManager.removeContainer() and container.destruct() in the onCloseCallback but none of them work.
this is my code:
command.register('chest', 'Open chest').overload((_, origin) => {
const plr = origin.getEntity()
if (!plr?.isPlayer()) return;
const inv = ContainerMenu.create(plr, FakeContainerType.DoubleChest, true)
inv.addItem(ItemStack.create('minecraft:diamond', 1, 2))
inv.sendToPlayer()
inv.onContainerClose(() => {
inv.destruct()
PlayerManager.removeContainer(plr.getNetworkIdentifier())
})
}, {})Metadata
Metadata
Assignees
Labels
No labels