How do I create a config using arrays for example, - Item - id - custom name - Item - id - custom name
i saw your github, you know how to create Config and use it correct? now you want to know how to save stuff array in config? for doing that: PHP: $this->getConfig()->set("Items", /*your own array here?*/); please tell me what do you want to save in to cfg? i'll make full code for you, just tell me what should save like array in Config.
for example, this mybe help you? PHP: //IDK function$configToturial = $this->getConfig();$yourArray = ["Apple" => 2/*you can get apples form player inv onJoin Event*/, "Beef" => 10];$configToturial->set("Items", $yourArray);//sorry im not in my ide, mybe this code have a little wrong? :P any more questions or problems?
PHP: public function openDouble(Player $sender) { foreach ($this->getAllAdd() as $config) { $item = $this->getItem($config["item"]); $slot = $this->getSlot($config["slot"]); $name = $this->getName($config["name"]); $name = $this->getLore($config["lore"]); $warpmenu = InvMenu::create(InvMenu::TYPE_DOUBLE_CHEST); $double = new Config($this->getDataFolder() . "/doublegui.yml", Config::YAML); $warpmenu->readonly(); $warpmenu->setName($double->get("title")); $warpmenu->setListener([$this, "handleDoubleMenu"]); $inventory = $warpmenu->getInventory(); $inventory->setItem($slot, $item->setCustomName($name)->setLore([$lore)])); $warpmenu->send($sender); } } this is what i have right now for the gui
PHP: # YAMLyaml_emit_file("file.yml", $array);# JSONfile_put_contents("file.json", json_encode($array));