WritableBookBase: Don't expose page deque on the API

putting this stuff on the API creates a nightmare because DS structures are both mutable and by-reference, so they have to be manually copied everywhere.
This commit is contained in:
Dylan K. Taylor 2019-07-16 17:52:58 +01:00
parent 27352486a0
commit 3d0e47ba14

View File

@ -149,17 +149,17 @@ abstract class WritableBookBase extends Item{
/** /**
* Returns an array containing all pages of this book. * Returns an array containing all pages of this book.
* *
* @return WritableBookPage[]|Deque * @return WritableBookPage[]
*/ */
public function getPages() : Deque{ public function getPages() : array{
return $this->pages; return $this->pages->toArray();
} }
/** /**
* @param WritableBookPage[]|Deque $pages * @param WritableBookPage[] $pages
*/ */
public function setPages(Deque $pages) : void{ public function setPages(array $pages) : void{
$this->pages = $pages; $this->pages = new Deque($pages);
} }
protected function deserializeCompoundTag(CompoundTag $tag) : void{ protected function deserializeCompoundTag(CompoundTag $tag) : void{