Hello, so I have a little question, basically I want to make it so when you do example /plist, there is a form with a list of values in an array in a config.yml, example PHP: values :- test- test1- test2- test3 The values are dynamic, they keep changing while the player play so I cannot use the case x: thingy, basically, I want it to be so if player click button test56 for example, it does send "hey" but if he click the button test23, it say "yo" Ik that in FormAPI by Jojoe we can array $data and Ig this is used for strings datas but I got no idea on how to use it For now I use that to list all values in `values` Code: $form->setTitle($langFile->get("values.Title.form")); foreach($player_file->get("values") as $values){ $form->addButton($values); } $form->sendToPlayer($player); If someone could help it would be nice, thank you EDIT: ok so I found a solution, first, make your array database to look like this Code: values: 1 - test 2 - test2 3 - test3 4 - test4 Then, in your form class, you will need to foreach your array like that Code: foreach($values_content as $values){ $form->addButton($values); } then, in your form function, add this code Code: if($data === null){ return; } $values_file= new Config("/path/to/custom/directory/" . "values_file.yml"); $values_content= $values_file->get("values"); $player->sendMessage("selected: " . $values_content[$data]); Basically $data = the index of your values array
I liked this post, because you are one of not many people who provide their solution if they solved the problem by themselves.