I want to use the workbench GUI with command. However, by all means error To appear :/ a lot code is https://forums.pmmp.io/threads/open-crafting-table-code.88 I borrowed from. PHP: public function onCommand(CommandSender $sender, Command $command, $label, array $args) { //Messages $Mes1 = "§eYou opened"; $Mes2 = "§a/vr §7 §8[ §aenchant§8 | §afurnace§8 | §astand§8 | §aworkbench§8 ] "; $x = $sender->getX();$y = $sender->getY();$z = $sender->getZ(); $le = $sender->getLevel(); if($sender instanceof Player) { switch ($command->getName()) { case "vr": if (isset($args[0])) { switch (strtolower($args[0])) { case "workbench": $table = $this->getServer()->getLevelByName($le)->getTile(new WindowInventory($sender, 9))->getInventory(); $sender->sendMessage($Mes1); $sender->addWindow($table); break; Since the code after this is not necessary for the question, I will not write it...
I think, that you need send workbench to player. This code allow to create fake chest: PHP: $block = Block::get(54);$block->x = floor($sender->x);$block->y = floor($sender->y)-2;$block->z = floor($sender->z);$block->level = $sender->level;$sender->level->sendBlocks([$sender],[$block]);$nbt = new CompoundTag('', [ new ListTag('Items', []), new StringTag('id', $id = Tile::CHEST), new IntTag('x', floor($sender->x)), new IntTag('y', floor($sender->y) - 2), new IntTag('z', floor($sender->z))]);/** @var Chest $tile */$tile = Tile::createTile('Chest', $sender->chunk, $nbt);$customInv = new ChestInventory($tile);$sender->addWindow($customInv);