mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
More consistent fluency in Item API
This commit is contained in:
@ -56,14 +56,17 @@ class WrittenBook extends WritableBook{
|
||||
* Sets the generation of a book.
|
||||
*
|
||||
* @param int $generation
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGeneration(int $generation) : void{
|
||||
public function setGeneration(int $generation) : self{
|
||||
if($generation < 0 or $generation > 3){
|
||||
throw new \InvalidArgumentException("Generation \"$generation\" is out of range");
|
||||
}
|
||||
$namedTag = $this->getNamedTag();
|
||||
$namedTag->setInt(self::TAG_GENERATION, $generation);
|
||||
$this->setNamedTag($namedTag);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,11 +84,14 @@ class WrittenBook extends WritableBook{
|
||||
* Sets the author of this book.
|
||||
*
|
||||
* @param string $authorName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAuthor(string $authorName) : void{
|
||||
public function setAuthor(string $authorName) : self{
|
||||
$namedTag = $this->getNamedTag();
|
||||
$namedTag->setString(self::TAG_AUTHOR, $authorName);
|
||||
$this->setNamedTag($namedTag);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,10 +107,13 @@ class WrittenBook extends WritableBook{
|
||||
* Sets the author of this book.
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title) : void{
|
||||
public function setTitle(string $title) : self{
|
||||
$namedTag = $this->getNamedTag();
|
||||
$namedTag->setString(self::TAG_TITLE, $title);
|
||||
$this->setNamedTag($namedTag);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user