PHP: public function onBlockBreak(BlockBreakEvent $event) { $player = $event->getPlayer(); $x = (Int)$event->getBlock()->getX(); $y = (Int)$event->getBlock()->getY(); $z = (Int)$event->getBlock()->getZ(); $level = $event->getBlock()->getLevel()->getName(); $blue = $this->getConfig()->get("BlueFlag"); $red = $this->getConfig()->get("RedFlag"); if (isset($this->editors[$player->getName()])) { $event->setCancelled(false); } else if ($x == $blue["x"] and $y == $blue["y"] and $z == $blue["z"] and $level = $blue["level"]) { if (array_key_exists($player->getName(), $this->temp["RedPlayers"])) { // player is on red team $event->setCancelled(); $item = new Item(35, 11, 1); $player->getInventory()->addItem($item); if (isset($this->temp[$player->getName()])) { $player->sendMessage("You can only place the flag once."); } else { $this->getServer()->broadcastMessage(TextFormat::GREEN." . $player->getDisplayName() . " captured the BLUE teams flag!"); $this->temp[$player->getName()] = true; $player->setNameTag(TextFormat::RED." . $player->getName()); } } else { $event->setCancelled(); } } else if ($x == $red["x"] and $y == $red["y"] and $z == $red["z"] and $level == $red["level"]) { if (array_key_exists($player->getName(), $this->temp["BluePlayers"])) { // player is on blue team $event->setCancelled(); $item = new Item(35,14, 1); $player->getInventory()->addItem($item); if (isset($this->temp[$player->getName()])) { $player->sendMessage("You can only place the flag once."); } else { $this->getServer()->broadcastMessage(TextFormat::GREEN." . $player->getDisplayName() . "captured the RED teams flag!"); // this line 108 $this->temp[$player->getName()] = true; $player->setNameTag(TextFormat::BLUE." . $player->getName()); } } else { $event->setCancelled(); } } else { $event->setCancelled(); } } public function onBlockPlace (BlockPlaceEvent $event) { $player = $event->getPlayer(); $x = (Int)$event->getBlock()->getX(); $y = (Int)$event->getBlock()->getY(); $z = (Int)$event->getBlock()->getZ(); $level = $event->getBlock()->getLevel()->getName(); if (isset($this->editors[$player->getName()])) { $event->setCancelled(false); } else if (isset($this->temp[$player->getName()]["RedFlag"])) { $coordarray = array("x" => $x, "y" => $y, "z" => $z, "level" => $level); $this->getConfig()->set("RedFlag", $coordarray); $player->sendMessage("Red flag set!"); unset($this->temp[$player->getName()]); } else if (isset($this->temp[$player->getName()]["BlueFlag"])) { $coordarray = array("x" => $x, "y" => $y, "z" => $z, "level" => $level); $this->getConfig()->set("BlueFlag", $coordarray); $player->sendMessage("Blue flag set!"); unset($this->temp[$player->getName()]); } else { if (isset($this->temp["RedPlayers"]) or isset($this->temp["BluePlayers"])) { // IDK why I made this function if(is_array($this->temp["RedPlayers"]) && array_key_exists($player->getName(), $this->temp["RedPlayers"])) { //Player is on the red team $config = $this->getConfig()->get("RedReturn"); if($x == $config["x"] and $y == $config["y"] and $z == $config["z"] and $level == $config["level"]) { if (isset($this->temp["RedPoints"])) { $points = $this->temp["RedPoints"] +1; $this->temp["RedPoints"] = $points; $event->setCancelled(); } else { $this->temp["RedPoints"] = 1; } $event->setCancelled(); $this->giveTeamItems($player->getName()); $this->broadcastScore($player); if (isset($this->temp[$player->getName()])) { unset($this->temp[$player->getName()]); $player->setNameTag(TextFormat::RED." . $player->getName()); } } } if(is_array($this->temp["BluePlayers"]) && array_key_exists($player->getName(), $this->temp["BluePlayers"])) { //Player is on the blue team $config = $this->getConfig()->get("BlueReturn"); if($x == $config["x"] and $y == $config["y"] and $z == $config["z"] and $level == $config["level"]) { if (isset($this->temp["BluePoints"])) { $points = $this->temp["BluePoints"] +1; $this->temp["BluePoints"] = $points; $event->setCancelled(); } else { $this->temp["BluePoints"] = 1; } $event->setCancelled(); $this->giveTeamItems($player->getName()); $this->broadcastScore($player); if (isset($this->temp[$player->getName()])) { unset($this->temp[$player->getName()]); $player->setNameTag(TextFormat::BLUE." . $player->getName()); } } } } $event->setCancelled(); } }
There is another mistake [13:03:55] [Server thread/INFO]: Loading source plugin CTF v1.0.0 [13:03:55] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)" (EXCEPTION) in "/CaptureTheFlag-master/src/ctf/Main" at line 117
PHP: $player->setNameTag(TextFormat::RED." . $player->getName()); Change it to PHP: $player->setNameTag(TextFormat::RED . $player->getName());
PHP: $this->getServer()->broadcastMessage(TextFormat::GREEN." . $player->getDisplayName() . "captured the RED teams flag!"); to... PHP: $this->getServer()->broadcastMessage(TextFormat::GREEN . $player->getDisplayName() . "captured the RED teams flag!");
PHP: if(is_array($this->temp["BluePlayers"]) && array_key_exists($player->getName(), $this->temp["BluePlayers"])) { //Player is on the blue team error ^ this
what wrong this ? PHP: if(is_array($this->temp["BluePlayers"]) && array_key_exists($player->getName(), $this->temp["BluePlayers"])) { //Player is on the blue team
@PmServer, please just use an IDE(NetBeans, PHPStorm,...) - It will point out your errors so you at least can try to fix it yourself.
also, here is another tip.... if you dont want a ide, when you have the errors, fix them one at a time. read the error, then fix the problem. The crashlog or console error ONLY shows the first wring thing, and not all of thwm. use that to your advantage, and that will help you fix the plugin. If you cant be bothered reading all of the crash, them they is a handy feature on pmt.mcpe.me that changes the "boring" text into sections, so its easier to read. also, if you do not want a propper IDE, then have a good text editor, like Notepad++ or Brackets, then search google for "PHP Formatter". those things tell you your errors too.