Backport other part of 2bffd5cc1c: Add timer measurements for autosave

This commit is contained in:
Dylan K. Taylor
2019-03-02 18:20:25 +00:00
parent 99606bbe23
commit 5c12bee874
2 changed files with 6 additions and 3 deletions

View File

@ -26,6 +26,8 @@ namespace pocketmine\command\defaults;
use pocketmine\command\Command; use pocketmine\command\Command;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\lang\TranslationContainer; use pocketmine\lang\TranslationContainer;
use function microtime;
use function round;
class SaveCommand extends VanillaCommand{ class SaveCommand extends VanillaCommand{
@ -43,7 +45,8 @@ class SaveCommand extends VanillaCommand{
return true; return true;
} }
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.save.start")); Command::broadcastCommandMessage($sender, new TranslationContainer("pocketmine.save.start"));
$start = microtime(true);
foreach($sender->getServer()->getOnlinePlayers() as $player){ foreach($sender->getServer()->getOnlinePlayers() as $player){
$player->save(); $player->save();
@ -53,7 +56,7 @@ class SaveCommand extends VanillaCommand{
$level->save(true); $level->save(true);
} }
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.save.success")); Command::broadcastCommandMessage($sender, new TranslationContainer("pocketmine.save.success", [round(microtime(true) - $start, 3)]));
return true; return true;
} }