Please help me I Have a Error, and i don't know where it. Please, help and read more, because it is my first redesigned plugin. I'm from Russia, and ignore errors PHP: <?php/*__PocketMine Plugin__name=SignProdescription= Live Signs at its best!version=1.0author=NIMclass=Signapiversion=11*/class Sign implements Plugin{ private $api, $server; public function __construct(ServerAPI $api, $server = false){ $this->api = $api; $this->server = ServerAPI::request(); } public function init(){ $this->api->addHandler("tile.update", array($this, "eventHandler"), 10); } public function eventHandler($data, $event){ switch ($event) { case "tile.update": if ($data->class === TILE_SIGN) { if($data->data["Monitor"] == "MONITOR" or $data->data["Монитор"] == "MONITOR"){ return; $data->setText(".count($this->api->player->getAll())."/".$this->server->maxClients)).", "MONITOR", "PLAYERS"); break; } public function __destruct(){ }}
Do you know what is the $data field? In a sign tile, the $data field is an array containing four contents, with the keys "Text1" to "Text4". According to https://github.com/PocketMine/PocketMine-MP/blob/master/src/world/Tile.php, there is no such array content called "MONITOR" or its Russian.
It is could it be? it? Code: public function setText($line1 = "", $line2 = "", $line3 = "", $line4 = ""){ if($this->class !== TILE_SIGN){ return false; } $this->data["Text1"] = $line1; $this->data["Text2"] = $line2; $this->data["Text3"] = $line3; $this->data["Text4"] = $line4; $this->server->api->tile->spawnToAll($this); $this->server->handle("tile.update", $this); return true; } It is this code? I am noob
Yes. First, what did you want to do in the first place? Second, you should only call the public function setText() and not anything else to change a sign's text.
I want that when you click that it was written in the chat. Sorry, i'm use translate, because don't know in English someone words