mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Fixed sub-optimal code in WritableBook
This commit is contained in:
parent
cdebb62c35
commit
a547e2cca8
@ -181,11 +181,11 @@ class WritableBook extends Item{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function pushPages(int $pageId, CompoundTag $namedTag, bool $downwards = true) : bool{
|
private function pushPages(int $pageId, CompoundTag $namedTag, bool $downwards = true) : bool{
|
||||||
if(empty($this->getPages())){
|
$pages = $this->getPages();
|
||||||
|
if(empty($pages)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pages = $this->getPages();
|
|
||||||
$type = $downwards ? -1 : 1;
|
$type = $downwards ? -1 : 1;
|
||||||
foreach($pages as $key => $page){
|
foreach($pages as $key => $page){
|
||||||
if(($key <= $pageId and $downwards) or ($key < $pageId and !$downwards)){
|
if(($key <= $pageId and $downwards) or ($key < $pageId and !$downwards)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user