From 6187ebc1a79caed42f31b7856464c110afb6dbc2 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 12 Jan 2023 19:41:57 +0300 Subject: [PATCH] more php8 spam fix --- src/pmf/PMF.php | 7 ++++++- src/pmf/PMFLevel.php | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pmf/PMF.php b/src/pmf/PMF.php index 447ef6d5..8cf45ebe 100644 --- a/src/pmf/PMF.php +++ b/src/pmf/PMF.php @@ -21,7 +21,12 @@ class PMF{ public function create($file, $type, $version = PMF_CURRENT_VERSION){ $this->file = $file; - @mkdir(dirname($this->file), 0755, true); + $dirname = dirname($this->file); + if(!is_dir($dirname)){ + @mkdir($dirname, 0755, true); + } + + if(!is_resource($this->fp)){ if(($this->fp = @fopen($file, "c+b")) === false){ return false; diff --git a/src/pmf/PMFLevel.php b/src/pmf/PMFLevel.php index 617c19a9..f6026dff 100644 --- a/src/pmf/PMFLevel.php +++ b/src/pmf/PMFLevel.php @@ -38,7 +38,11 @@ class PMFLevel extends PMF{ $this->saveData(false); $this->locationTable = []; $cnt = pow($this->levelData["width"], 2); - @mkdir(dirname($this->file) . "/chunks/", 0755); + $dirname = dirname($this->file) . "/chunks/"; + if(!is_dir($dirname)){ + @mkdir($dirname , 0755); + } + for($index = 0; $index < $cnt; ++$index){ $this->chunks[$index] = false; $this->chunkChange[$index] = false;