Added exception throws when a closed tile or entity attempts to schedule itself for updating

I can't believe it took so long to find what was causing these stdClass bugs.
This commit is contained in:
Dylan K. Taylor 2018-06-07 12:37:26 +01:00
parent fdd5b7b9c9
commit 14914781fc
2 changed files with 6 additions and 0 deletions

View File

@ -1377,6 +1377,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
}
final public function scheduleUpdate() : void{
if($this->closed){
throw new \InvalidStateException("Cannot schedule update on garbage entity " . get_class($this));
}
$this->level->updateEntities[$this->id] = $this;
}

View File

@ -254,6 +254,9 @@ abstract class Tile extends Position{
}
final public function scheduleUpdate() : void{
if($this->closed){
throw new \InvalidStateException("Cannot schedule update on garbage tile " . get_class($this));
}
$this->level->updateTiles[$this->id] = $this;
}