mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-31 23:33:06 +00:00
Backport other part of 2bffd5cc1c326670c25386ce78e5c690f4c5fd54: Add timer measurements for autosave
This commit is contained in:
parent
99606bbe23
commit
5c12bee874
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5dad5db214ce0c94be0235e93d8253d0aec19c82
|
Subproject commit 73ed1ab3e1f2a1644fe908b439f8cf8ed6c12ab5
|
Loading…
x
Reference in New Issue
Block a user