Something like PHP: PlayerInteractEvent//check that it is the sign you wantif($this->gameStarted){return;}//code to join game
Maybe you should first tell us how come the sign is not locked. We can't lock something unless we know there is a door. Like, what plugin are you using that makes the sign a portal?
We can't help you. You have to do that yourself. We don't even know how you define that a game has started.
Yes, and we don't know your situation well enough, so we can't help you. For example, we don't even know what you meant by "when the game starts". What game is that? Anything not from default PocketMine and you didn't mention what plugin it is, we have no idea.
What @PEMapModder is trying to say is that we can't help you without seeing your code, or atleast the part that starts games. So post the code for further help.
Here code sorry . PHP: public function onPlayerTouch(PlayerInteractEvent $event) { if($event->getBlock()->getId() == 68 || $event->getBlock()->getId() == 63) { $sign = $event->getPlayer()->getLevel()->getTile($event->getBlock()); if($sign instanceof Sign) { $signtext = $sign->getText(); if($signtext[0] == "[Game]"){ $player = $event->getPlayer(); $name = $player->getName(); $this->getServer()->getScheduler()->scheduleRepeatingTask(new Task1($this), 20*60); if(empty($signtext[3]) !== true) { $worlds = $signtext[3]; $this->getServer()->loadLevel($worlds); $event->getPlayer()->teleport(Server::getInstance()->getLevelByName($worlds)->getSafeSpawn()); if (($world = $this->getServer()->getLevelByName($worlds))) { $count = count($world->getPlayers()); $player->sendTip(TextFormat::GREEN. "§l§[Game] Teleporting ..... !"); $this->getServer()->broadcastMessage("§l§6[Game]§a $name join game §7[$count/8]"); $player->setNameTag("§c" .$player->getName()); $duration = $this->cfg->get("Duration"); $particles = $this->cfg->get("Particles"); $amplifier = $this->cfg->get("Amplifier"); $id = $this->cfg->get("Effect-ID"); $effect = Effect::getEffect($id); $effect->setVisible($particles); $effect->setAmplifier($amplifier); $effect->setDuration($duration); $player->addEffect($effect); $player->getInventory()->clearAll(); if($this->gameStarted === true & $this->start = 1 & count($this->players)> 8){ $player->sendMessage("§l§4[Game] the game is full !"); $player->isOp(); $this->refreshSign(); return true; //sign event use } } } } } } }
For refreshsign => PHP: public function refreshSign() { foreach($this->getServer()->getLevels() as $levels) { $tiles = $this->getServer()->getLevelByName("test")->getTile(new Vector3(-94, 73, 0)); if($tiles instanceof Sign) { if (($world = $this->getServer()->getLevelByName("world"))) { $count = count($world->getPlayers()); $tiles->setText("§l§6[Game]", "§l§bJoin !", "[$count/8]", "world");//code Full Help And Time For join .
Just cancel the event on playerinteract event if the sign is a game sign and the gamestate is started...
What? I'm saying cancel the player touch event if the player is touches the sign and the sign is a game sign and the game is in the started state.
You mean in another plugin right? 1. You need to consider handler priority 2. The sign tp event handler should have @ignoreCancelled turned on, or it would be impossible (unless you cancel the tp event).