mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
LevelProviderManager: make addProvider() throw InvalidArgumentException instead of LevelException
LevelException is not useful because it's too generic.
This commit is contained in:
parent
6f00a30ad7
commit
5d769147ca
@ -27,7 +27,6 @@ use pocketmine\level\format\io\leveldb\LevelDB;
|
||||
use pocketmine\level\format\io\region\Anvil;
|
||||
use pocketmine\level\format\io\region\McRegion;
|
||||
use pocketmine\level\format\io\region\PMAnvil;
|
||||
use pocketmine\level\LevelException;
|
||||
|
||||
abstract class LevelProviderManager{
|
||||
protected static $providers = [];
|
||||
@ -42,11 +41,11 @@ abstract class LevelProviderManager{
|
||||
/**
|
||||
* @param string $class
|
||||
*
|
||||
* @throws LevelException
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function addProvider(string $class){
|
||||
if(!is_subclass_of($class, LevelProvider::class)){
|
||||
throw new LevelException("Class is not a subclass of LevelProvider");
|
||||
throw new \InvalidArgumentException("Class is not a subclass of LevelProvider");
|
||||
}
|
||||
/** @var LevelProvider $class */
|
||||
self::$providers[strtolower($class::getProviderName())] = $class;
|
||||
|
Loading…
x
Reference in New Issue
Block a user