PHP: public function onSignChange(SignChangeEvent $event): void { $sign = $event->getSign(); $line = $sign->getLine(0); }
PHP: /*** Returns the text currently on the sign.*/public function getOldText() : SignText{ return $this->sign->getText();}/*** Returns the text which will be on the sign after the event.*/public function getNewText() : SignText{ return $this->text;}/*** Sets the text to be written on the sign after the event.*/public function setNewText(SignText $text) : void{ $this->text = $text;}
This would help you PHP: public function onSignChang(SignChangeEvent $e){ $player = $e->getPlayer(); //Return the Player $oldtext = $e->getOldText(); //Return Old Sign Text as the Class SignText $newtext = $e->getNewText(); //Return New Sign Text as the Class SignText $settext = $e->setNewText(new SignText(["First Line", "Second Line"])); //Set New Sign Text only by using the Class SignText() $oldLines = $e->getOldText()->getLines(); //Return Old Sign Text Lines as an Array $oldLine = $e->getOldText()->getLine(0); //Return Old Sign Text as a String by choosing a Line, 0 = First Line $newLines = $e->getNewText()->getLines(); //Return New Sign Text Lines as an Array $newLine = $e->getNewText()->getLine(0); // Return New Sign Text as a String by choosing a Line, 0 = First Line}