From 8be2a94762e160dda7105e8b62626f56b41ada3d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 7 Nov 2021 00:14:25 +0000 Subject: [PATCH] 4.0.0-BETA11 compatibility --- plugin.yml | 2 +- src/dktapps/OpenFilesLeakDebugger/Main.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugin.yml b/plugin.yml index 27cd165..b55696f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: OpenFilesLeakDebugger main: dktapps\OpenFilesLeakDebugger\Main version: 0.1.0 -api: 3.0.0 +api: 4.0.0 load: STARTUP author: dktapps description: Debugger for file descriptor leaks diff --git a/src/dktapps/OpenFilesLeakDebugger/Main.php b/src/dktapps/OpenFilesLeakDebugger/Main.php index 60f923d..d3c7070 100644 --- a/src/dktapps/OpenFilesLeakDebugger/Main.php +++ b/src/dktapps/OpenFilesLeakDebugger/Main.php @@ -2,7 +2,9 @@ namespace dktapps\OpenFilesLeakDebugger; +use pocketmine\errorhandler\ErrorToExceptionHandler; use pocketmine\plugin\PluginBase; +use pocketmine\utils\Process; use pocketmine\utils\Utils; class Main extends PluginBase{ @@ -12,7 +14,7 @@ class Main extends PluginBase{ private $os; - public function onEnable(){ + public function onEnable() : void{ @mkdir($this->getDataFolder() . "dudFiles", 0777, true); //Open some files to make sure we can close some to make space for proc_open() if the error should occur @@ -43,7 +45,7 @@ public function onEnable(){ $this->getLogger()->error("Operating system not supported"); goto a; //i don't care if goto is bad, this is a debugging plugin } - @Utils::execute($cmd, $stdout, $stderr); + @Process::execute($cmd, $stdout, $stderr); $this->getLogger()->emergency("File descriptor leak results:"); $this->getLogger()->emergency("stdout:\n$stdout"); $this->getLogger()->emergency("stderr:\n$stderr"); @@ -51,7 +53,7 @@ public function onEnable(){ } a: - Utils::errorExceptionHandler($severity, $message, $file, $line); + ErrorToExceptionHandler::handle($severity, $message, $file, $line); }); //For testing the plugin itself only.