Where is the function to set sign text? I thought it was in \pocketmine\tile\sign? And also an example on how to use would be nice EDIT:nvm i found it not exactly sure how to use it though
I will be nice search before creating threads! i already posted about this -_- But Ok : PHP: $tile = $this->getServer()->getLevelByName("world")->getTile(new Vector3($x,$y, $z));//gets the positionif($sg1tile instanceof Sign){//prevent from crash if the current position isn't a sign$tile->setText("Text Line 1", "Text Line 2", "Text Line 3", "Text Line 4");}
This is what im using PHP: public function lottoGame(PlayerInteractEvent $event){ $block = $event->getPlayer()->getLevel()->getTile($event->getBlock()); if($block instanceof Sign){ $signtext = $block->getText(); if($signtext[0] === "[Lottery]"){ $block->setText( "§6[Lottery]", "§bTap to play" ); }
Its just for good measure lol the goal is when someone creates a sign and the first line is [Lottery] the text will be replaced with a colored [Lottery] txt and will become an actual game sign in which when clicked will run a command(the lottery command)
More effecient PHP: public function onSignCreate(SignChangeEvent $event){if($event->getLine(0) === 'lottery'){ // check does player is creating lottery sign if($player->hasPermission('some.perm')){// check perm. // Format sign $event->setLine(0, '[LotterY]'); $event->setLine(1, 'Tap to play'); $event->setLine(2, ''); $event->setLine(3, ''); // Save sign $this->signs[$event->getBlock()->getPosition()] // Blah blah, or whatever you do it. // Inform player about the action he did $event->getPlayer()->sendMessage('[LotterY] Sign created'); }}}