Hi! im making DonateRanks, a plugin request by a user, so i want to make a list, e.g the plugin makes the ranks.yml, so when they run the command /donate ranks list 1 they get: ---------Rank List: [1/4]------------ 1. Vip 2. Vip+ 3. Admin 4. Rank and making list, so i thinkg using arrays or something. please help!
In config: Code: Admin VIP VIP+ OR: Ranks: - Admin - VIP - VIP+ Then do: PHP: $player->sendMessage("---[LIST]---");foreach($this->getConfig()->getAll() as $rank){$player->sendMessage($rank);}And on the Ranks: exampleforeach($this->getConfig()->get("Ranks") as $rank){.. code}
if you need to change this list often , you can save an array in "ranks.yml" using \pocketmine\utils\Config example: PHP: $list = (new Config($path, Config::YAML, ['line1', 'line2', 'line3', 'line4']))->getAll();foreach($list as $line){Player->sendMessage($line);} if you don't need to change this list , simply send messanges to the sender of the command PHP: $sender->sendMessage('line1');$sender->sendMessage('line2');$sender->sendMessage('line3');//or just 1 message using End Of Line
PHP: $player->sendMessage("---[LIST]---");foreach($this->getConfig()->getAll() as $rank){$player->sendMessage($rank);}And on the Ranks: exampleforeach($this->getConfig()->get("Ranks") as $rank){.. code} .. code ?
ok, on plugin enable "onEnable" add this code to save the file into the plugin folder: PHP: @mkdir($this->getDataFolder); //makes the foldernew Config($this->getDataFolder.'ranks.yml', Config::YAML, ['line1', 'line2', 'line3', 'line4'/*add how many you want*/]); when a player run the command use this code to send the list: PHP: //you must define $path$list = (new Config($path, Config::YAML, ['line1', 'line2', 'line3', 'line4']))->getAll();foreach($list as $line){Player->sendMessage($line);}