mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
bad fix for WritableBook phpstan warning
master has this shit so much better
This commit is contained in:
parent
39c607cbd5
commit
8ecf5e02b9
@ -186,16 +186,18 @@ class WritableBook extends Item{
|
|||||||
* @return CompoundTag[]
|
* @return CompoundTag[]
|
||||||
*/
|
*/
|
||||||
public function getPages() : array{
|
public function getPages() : array{
|
||||||
$pages = $this->getNamedTag()->getListTag(self::TAG_PAGES);
|
/** @var CompoundTag[] $pages */
|
||||||
if($pages === null){
|
$pages = $this->getPagesTag()->getValue();
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $pages->getValue();
|
return $pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPagesTag() : ListTag{
|
protected function getPagesTag() : ListTag{
|
||||||
return $this->getNamedTag()->getListTag(self::TAG_PAGES) ?? new ListTag(self::TAG_PAGES, [], NBT::TAG_Compound);
|
$pagesTag = $this->getNamedTag()->getListTag(self::TAG_PAGES);
|
||||||
|
if($pagesTag !== null and $pagesTag->getTagType() === NBT::TAG_Compound){
|
||||||
|
return $pagesTag;
|
||||||
|
}
|
||||||
|
return new ListTag(self::TAG_PAGES, [], NBT::TAG_Compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user