public function getContents();
public function saveInventory(Player $player, Inventory $inv) { $n = trim(strtolower($player->getName())); if ($n === "") { return false; } $d = substr($n, 0, 1); if (!is_dir($this->getDataFolder() . $d)) { mkdir($this->getDataFolder() . $d); } $path = $this->getDataFolder() . $d . "/" . $n . ".yml"; $cfg = new Config($path, Config::YAML); $yaml = $cfg->getAll(); if ($this->isGlobal) { $ln = "*"; } else { $ln = trim(strtolower($player->getLevel()->getName())); } $yaml[$ln] = []; foreach ($inv->getContents() as $slot => &$item) { $yaml[$ln][$slot] = implode(":", [$item->getId(), $item->getDamage(), $item->getCount()]); } $inv->clearAll(); $cfg->setAll($yaml); $cfg->save(); return true; }