PHP: public function onBreak(BlockBreakEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); $pro = 0; if ($block->getId() == 1) { $pro += 1; $player->SendPopup("§aBreak: ".$pro); }}
I think this code help PHP: public function onBreak(BlockBreakEvent $event){$data = array(); foreach($this->getServer()->getOnlinePlayers() as $pf){ $name = $pf->getName(); $data[$name] = 0; } $player = $event->getPlayer(); $block = $event->getBlock(); if($block === 1){ $data[$name] = $data[$name]+0;$player->SendPopup("§aBreak: ".$data[$name]); }else{ $data[$p->getName()] = 0; } I recommend use config save
No, don't abuse config for storing that kind of data, use a database instead if you want to save the amount even after restarting the server.
I created a file on the date where the quantity will be stored and it worked more now I don't know how I will get the number of blocks broken by the person to display in the popup PHP: public function onJoin(PlayerJoinEvent $ev){ $player = $ev->getPlayer(); $inv = $player->getInventory(); $player->getInventory()->clearAll(); /*Vai armazenar os dados de mineracao*/ $config = new Config($this->getDataFolder() . "Miner.yml", Config::YAML); /*vai ver e o player existe na data ao logar se não vai criar um nome do player nela e vai da 0 de xp em mineracao*/ if (!$config->exists($player->getName())) { $config->set($player->getName(), 0); $config->save(); }public function onBreak(BlockBreakEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); $name = $player->getName(); $config = new Config($this->getDataFolder() . "Miner.yml", Config::YAML); if($block->getId() == 1){ $config->set($name, $config->get($name) + 1); $config->save(); $player->SendPopup("§aProgresso: ".$name); if ($name >= 10) { $player->SendTitle("fpi"); } }}