how do i send only one query per player ? i currently update player's blocks mined every time they break a block and it lags PHP: -- # {add_blocksMined-- # :username string-- # :blocksMined intUPDATE statsSET blocksMined = blocksMined + :blocksMinedWHERE player = :username;-- # } PHP: public static function addBlocksMined(Player $player, int $count = 1){ $plugin = MainClass::getInstance(); $plugin->provider->executeChange("add_blocksMined", [ "username" => $player->getName(), "blocksMined" => $count ]);} PHP: public function onBreak(BlockBreakEvent $event) { API::addBlocksMined($player);}
Before you worry about lag you should get it working; you haven't even defined $player. Do you use an IDE?