mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
DumpMemoryCommand: removed token annoyance, use date/time to identify memory dumps by default
This commit is contained in:
parent
357674cb54
commit
c243daabe1
@ -27,13 +27,11 @@ use pocketmine\command\CommandSender;
|
||||
|
||||
class DumpMemoryCommand extends VanillaCommand{
|
||||
|
||||
private static $executions = 0;
|
||||
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Dumps the memory",
|
||||
"/$name <TOKEN (run once to get it)> [path]"
|
||||
"/$name [path]"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.dumpmemory");
|
||||
}
|
||||
@ -43,16 +41,7 @@ class DumpMemoryCommand extends VanillaCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
$token = strtoupper(substr(sha1(BOOTUP_RANDOM . ":" . $sender->getServer()->getServerUniqueId() . ":" . self::$executions), 6, 6));
|
||||
|
||||
if(count($args) < 1 or strtoupper($args[0]) !== $token){
|
||||
$sender->sendMessage("Usage: /" . $this->getName() . " " . $token);
|
||||
return true;
|
||||
}
|
||||
|
||||
++self::$executions;
|
||||
|
||||
$sender->getServer()->getMemoryManager()->dumpServerMemory($args[1] ?? ($sender->getServer()->getDataPath() . "/memory_dumps/$token"), 48, 80);
|
||||
$sender->getServer()->getMemoryManager()->dumpServerMemory($args[0] ?? ($sender->getServer()->getDataPath() . "/memory_dumps/" . date("D_M_j-H.i.s-T_Y")), 48, 80);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user