Delete chest when close. Code : PHP: public function sendInventory (Player $player) {$nbt = new CompoundTag ( "", [new StringTag ( "id", Tile::CHEST ),new IntTag ( "Inventory", 1 ),new IntTag ( "x", ( int ) $player->getX () ),new IntTag ( "y", ( int ) $player->getY () ),new IntTag ( "z", ( int ) $player->getZ () )] );/** @var Chest $tile */$tile = Tile::createTile ( "Chest", $player->getLevel (), $nbt );$block = Block::get ( Block::CHEST );$block->x = ( int ) $tile->x;$block->y = ( int ) $tile->y;$block->z = ( int ) $tile->z;$block->level = $tile->getLevel ();$block->level->sendBlocks ( [$player], [$block] );if ($tile instanceof Chest) {// Items$i = $tile->getInventory();$i->addItem(Item::get(Item::STONE, 0, 1));}$player->addWindow($tile->getInventory());}
I don't think you can remove that block, My tip is spawn that block about 5-4 blocks under the player. That would make it look a hidden
still need to remember that there maybe blocks there and you need to undo it when closed consider referring to some private vault plugins like https://github.com/Muqsit/PlayerVaults