ignore me This code works, However if you type /pv 1 (or any number) it will send a popup with vault opening... but wont acctually move on from there. No error message.
PHP: }else { if($sender->hasPermission("pv.vault." . $args[0])) { $sender->addWindow($this->loadVault($sender, $args[0])); $sender->sendTip("§aOpening Vault..."); $this->using[strtolower($sender->getName())] = (int)$args[0]; return true; }else { $sender->sendMessage("§6PrivateVault§7>> §cYou do not have permission to open that vault."); return true; } } loads vault defined here: PHP: public function loadVault(Player $player, $number) { $itemblock = Item::fromString("chest"); $block = $itemblock->getBlock(); $player->getLevel()->setBlock(new Vector3($player->getX(), 128, $player->getZ()), $block); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $player->getX()), new IntTag("y", $player->getY()), new IntTag("z", $player->getZ()) ]); $nbt->Items->setTagType(NBT::TAG_Compound); $tile = Tile::createTile("Chest", $player->getLevel(), $nbt); if($player instanceof Player) { $player = $player->getName(); } $player = strtolower($player); $cfg = new Config($this->getDataFolder() . "players/" . $player . ".yml", Config::YAML); $tile->getInventory()->clearAll(); for ($i = 0; $i < 26; $i++) { $ite = $cfg->getNested("$number.items." . $i); $item = Item::get($ite[0]); $item->setDamage($ite[1]); $item->setCount($ite[2]); foreach ($ite[3] as $key => $en) { $enchantment = Enchantment::getEnchantment($en[0]); $enchantment->setLevel($en[1]); $item->addEnchantment($enchantment); } $tile->getInventory()->setItem($i, $item); } return $tile->getInventory(); } confused
Your chest block is at (new Vector3($player->getX(), 128, $player->getZ()).. but the tile is created at $player->getY().. make sure the tile is created at the correct pos
There is some plugins on youtube called Bau, but the problem is it only has 3 PV's but you could look at the code of those to fix it.