mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +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
|
||||
*/
|
||||
public function getSaveId(){
|
||||
if(!isset(self::$saveNames[static::class])){
|
||||
throw new \InvalidStateException("Entity is not registered");
|
||||
}
|
||||
reset(self::$saveNames[static::class]);
|
||||
return current(self::$saveNames[static::class]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user