mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
setText now nullable instead of overwriting with empty lines (#1204)
This commit is contained in:
parent
297cfcf168
commit
226175f961
@ -54,11 +54,30 @@ class Sign extends Spawnable{
|
|||||||
unset($this->namedtag->Creator);
|
unset($this->namedtag->Creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes contents of the specific lines to the string provided.
|
||||||
|
* Leaves contents of the specifc lines as is if null is provided.
|
||||||
|
*
|
||||||
|
* @param null|string $line1
|
||||||
|
* @param null|string $line2
|
||||||
|
* @param null|string $line3
|
||||||
|
* @param null|string $line4
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function setText($line1 = "", $line2 = "", $line3 = "", $line4 = ""){
|
public function setText($line1 = "", $line2 = "", $line3 = "", $line4 = ""){
|
||||||
$this->namedtag->Text1->setValue($line1);
|
if($line1 !== null){
|
||||||
$this->namedtag->Text2->setValue($line2);
|
$this->namedtag->Text1->setValue("Text1", $line1);
|
||||||
$this->namedtag->Text3->setValue($line3);
|
}
|
||||||
$this->namedtag->Text4->setValue($line4);
|
if($line2 !== null){
|
||||||
|
$this->namedtag->Text2->setValue("Text2", $line2);
|
||||||
|
}
|
||||||
|
if($line3 !== null){
|
||||||
|
$this->namedtag->Text3->setValue("Text3", $line3);
|
||||||
|
}
|
||||||
|
if($line4 !== null){
|
||||||
|
$this->namedtag->Text4->setValue("Text4", $line4);
|
||||||
|
}
|
||||||
$this->onChanged();
|
$this->onChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user