mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Backport other part of 2bffd5cc1c
: Add timer measurements for autosave
This commit is contained in:
@ -26,6 +26,8 @@ namespace pocketmine\command\defaults;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use function microtime;
|
||||
use function round;
|
||||
|
||||
class SaveCommand extends VanillaCommand{
|
||||
|
||||
@ -43,7 +45,8 @@ class SaveCommand extends VanillaCommand{
|
||||
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){
|
||||
$player->save();
|
||||
@ -53,7 +56,7 @@ class SaveCommand extends VanillaCommand{
|
||||
$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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user