mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
VanillaEffects: return null instead of throwing on invalid effect ID
we don't expect plugin devs to be using this any more, and it doesn't make sense to throw on data deserialize. This throw was unchecked and a potential server crash might have occurred in Living on data load.
This commit is contained in:
parent
a9c09e4517
commit
89458660cf
@ -107,14 +107,11 @@ final class VanillaEffects{
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @return Effect
|
||||
* @return Effect|null
|
||||
*/
|
||||
public static function byMcpeId(int $id) : Effect{
|
||||
public static function byMcpeId(int $id) : ?Effect{
|
||||
self::checkInit();
|
||||
if(!isset(self::$mcpeIdMap[$id])){
|
||||
throw new \InvalidArgumentException("No such effect with MCPE ID $id");
|
||||
}
|
||||
return self::$mcpeIdMap[$id];
|
||||
return self::$mcpeIdMap[$id] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user