Hello great coders, Can somebody makes a code: If a player interact to a sign that i can get the text of this sign?? Best Regards Sensej
U can already do that you go in folder world open the folder on witch world u wanna check the signs and open tiles.yml you'll find which player wrote it and what it says (I'm pretty sure if they delete the sign it will still be saved) I'm happy to help -Wantedkillerss
Sorry i mean i want to replace the text: if($this->sign->gettext($line[1] == "test"); { $this->sign->setText($line[1] = "Work"); }
so i want use it as a Monitor to see how many players are online but worldmonitor doesent work so i ask here
But this is useless do /list or go in the settings it shows how many players are there in your server
Get the Tile of a sign, and use the function getText() which will return a array of each line on the sign
ok why did not work? PHP: public function playerBlockTouch(PlayerInteractEvent $event) { $blockid = $event->getBlock()->getID(); if($blockid == 323 || $blockid == 63 || $blockid == 68) { if($tile instanceof Sign) { $sign->getText(); if($t[0] == "test") { $tile->setText($t[0], "ok"); } } } }
Did u transfer it into a phar file? And what is u are trying to do with this cause its kinda hard to help without even knowing what you're doing and what error did the console give u?
1: DevTools can read plugin files (reading sourcecode) 2. I want a code which search signs with the text on line 1 with [Status] and add text on line 2 with the playerscount ([Status] 20/25) and if you tap them (playerinteract event) it will run my code
The Tile variable isn't defined, get the Tile by using $event->getBlock()->getLevel()->getTile($event-getBlock()->getX(), $event-getBlock()->getY(), $event->getBlock()->getZ()); or something like this I can't remember what exact
The error in his snippet is obvious enough. Last time, $event->getBlock()->getLevel()->getTile($event->getBlock()) is ok enough. Also getTile() must be given a Vector3 instance not three numbers.