mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
Entity: Throw exception when trying to get save ID of non registered entity
This commit is contained in:
parent
90fc649441
commit
684fd46d09
@ -789,6 +789,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSaveId(){
|
public function getSaveId(){
|
||||||
|
if(!isset(self::$saveNames[static::class])){
|
||||||
|
throw new \InvalidStateException("Entity is not registered");
|
||||||
|
}
|
||||||
reset(self::$saveNames[static::class]);
|
reset(self::$saveNames[static::class]);
|
||||||
return current(self::$saveNames[static::class]);
|
return current(self::$saveNames[static::class]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user