From 441a98e60ac6e86d190ae054ec6dbf10a866a66a Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 27 Nov 2014 13:16:39 +0100 Subject: [PATCH] Removed old trigger_error() calls, closes #2335 --- src/pocketmine/level/format/anvil/RegionLoader.php | 7 ++++--- src/pocketmine/level/format/mcregion/RegionLoader.php | 7 ++++--- src/pocketmine/plugin/PluginDescription.php | 6 ++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/level/format/anvil/RegionLoader.php b/src/pocketmine/level/format/anvil/RegionLoader.php index 3a2a16a2b..5d102d470 100644 --- a/src/pocketmine/level/format/anvil/RegionLoader.php +++ b/src/pocketmine/level/format/anvil/RegionLoader.php @@ -31,6 +31,7 @@ use pocketmine\nbt\tag\Int; use pocketmine\nbt\tag\IntArray; use pocketmine\nbt\tag\Long; use pocketmine\utils\Binary; +use pocketmine\utils\MainLogger; class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{ const VERSION = 1; @@ -88,11 +89,11 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{ } if($length > ($this->locationTable[$index][1] << 12)){ //Invalid chunk, bigger than defined number of sectors - trigger_error("Corrupted bigger chunk detected", E_USER_WARNING); + MainLogger::getLogger()->error("Corrupted chunk detected"); $this->locationTable[$index][1] = $length >> 12; $this->writeLocationIndex($index); }elseif($compression !== self::COMPRESSION_ZLIB and $compression !== self::COMPRESSION_GZIP){ - trigger_error("Invalid compression type", E_USER_WARNING); + MainLogger::getLogger()->error("Invalid compression type"); return false; } @@ -101,7 +102,7 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{ if($chunk instanceof Chunk){ return $chunk; }elseif($forward === false){ - trigger_error("Corrupted chunk detected", E_USER_WARNING); + MainLogger::getLogger()->error("Corrupted chunk detected"); $this->generateChunk($x, $z); return $this->readChunk($x, $z, $generate, true); diff --git a/src/pocketmine/level/format/mcregion/RegionLoader.php b/src/pocketmine/level/format/mcregion/RegionLoader.php index 40adda4d8..535c651b8 100644 --- a/src/pocketmine/level/format/mcregion/RegionLoader.php +++ b/src/pocketmine/level/format/mcregion/RegionLoader.php @@ -32,6 +32,7 @@ use pocketmine\nbt\tag\Int; use pocketmine\nbt\tag\IntArray; use pocketmine\nbt\tag\Long; use pocketmine\utils\Binary; +use pocketmine\utils\MainLogger; class RegionLoader{ const VERSION = 1; @@ -109,11 +110,11 @@ class RegionLoader{ } if($length > ($this->locationTable[$index][1] << 12)){ //Invalid chunk, bigger than defined number of sectors - trigger_error("Corrupted bigger chunk detected", E_USER_WARNING); + MainLogger::getLogger()->error("Corrupted bigger chunk detected"); $this->locationTable[$index][1] = $length >> 12; $this->writeLocationIndex($index); }elseif($compression !== self::COMPRESSION_ZLIB and $compression !== self::COMPRESSION_GZIP){ - trigger_error("Invalid compression type", E_USER_WARNING); + MainLogger::getLogger()->error("Invalid compression type"); return false; } @@ -122,7 +123,7 @@ class RegionLoader{ if($chunk instanceof Chunk){ return $chunk; }elseif($forward === false){ - trigger_error("Corrupted chunk detected", E_USER_WARNING); + MainLogger::getLogger()->error("Corrupted chunk detected"); $this->generateChunk($x, $z); return $this->readChunk($x, $z, $generate, true); diff --git a/src/pocketmine/plugin/PluginDescription.php b/src/pocketmine/plugin/PluginDescription.php index 634e417fa..74afaddd5 100644 --- a/src/pocketmine/plugin/PluginDescription.php +++ b/src/pocketmine/plugin/PluginDescription.php @@ -66,7 +66,7 @@ class PluginDescription{ $this->main = $plugin["main"]; $this->api = !is_array($plugin["api"]) ? [$plugin["api"]] : $plugin["api"]; if(stripos($this->main, "pocketmine\\") === 0){ - trigger_error("Invalid PluginDescription main, cannot start within the PocketMine namespace", E_USER_ERROR); + throw new PluginException("Invalid PluginDescription main, cannot start within the PocketMine namespace"); return; } @@ -97,9 +97,7 @@ class PluginDescription{ if(isset($plugin["load"])){ $order = strtoupper($plugin["load"]); if(!defined(PluginLoadOrder::class . "::" . $order)){ - trigger_error("Invalid PluginDescription load", E_USER_ERROR); - - return; + throw new PluginException("Invalid PluginDescription load"); }else{ $this->order = constant(PluginLoadOrder::class . "::" . $order); }