mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
Fixed crashdump generation when crashing before PluginManager was created
This commit is contained in:
parent
e2275cc8ec
commit
4f2bcb61d6
@ -101,9 +101,12 @@ class CrashDump{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
private $path;
|
private $path;
|
||||||
|
|
||||||
public function __construct(Server $server){
|
private ?PluginManager $pluginManager;
|
||||||
|
|
||||||
|
public function __construct(Server $server, ?PluginManager $pluginManager){
|
||||||
$this->time = microtime(true);
|
$this->time = microtime(true);
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
|
$this->pluginManager = $pluginManager;
|
||||||
|
|
||||||
$crashPath = Path::join($this->server->getDataPath(), "crashdumps");
|
$crashPath = Path::join($this->server->getDataPath(), "crashdumps");
|
||||||
if(!is_dir($crashPath)){
|
if(!is_dir($crashPath)){
|
||||||
@ -166,11 +169,11 @@ class CrashDump{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function pluginsData() : void{
|
private function pluginsData() : void{
|
||||||
if($this->server->getPluginManager() instanceof PluginManager){
|
if($this->pluginManager !== null){
|
||||||
|
$plugins = $this->pluginManager->getPlugins();
|
||||||
$this->addLine();
|
$this->addLine();
|
||||||
$this->addLine("Loaded plugins:");
|
$this->addLine("Loaded plugins:");
|
||||||
$this->data["plugins"] = [];
|
$this->data["plugins"] = [];
|
||||||
$plugins = $this->server->getPluginManager()->getPlugins();
|
|
||||||
ksort($plugins, SORT_STRING);
|
ksort($plugins, SORT_STRING);
|
||||||
foreach($plugins as $p){
|
foreach($plugins as $p){
|
||||||
$d = $p->getDescription();
|
$d = $p->getDescription();
|
||||||
|
@ -1476,7 +1476,7 @@ class Server{
|
|||||||
ini_set("memory_limit", '-1'); //Fix error dump not dumped on memory problems
|
ini_set("memory_limit", '-1'); //Fix error dump not dumped on memory problems
|
||||||
try{
|
try{
|
||||||
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_create()));
|
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_create()));
|
||||||
$dump = new CrashDump($this);
|
$dump = new CrashDump($this, $this->pluginManager ?? null);
|
||||||
|
|
||||||
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_submit($dump->getPath())));
|
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_submit($dump->getPath())));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user