I Have a problem with my plugin Code: [Server] [21:18:46] [Server thread/INFO]: Loading source plugin GameLobby v1 [Server] [21:18:46] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected 'public function Receive' (T_STRING), expecting function (T_FUNCTION)" (EXCEPTION) in "/GameLobby/src/StuckDexter/lg" at line 101 [Server] [21:18:46] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump [Server] [21:18:46] [Server thread/EMERGENCY]: Please upload the "/storage/emulated/0/PocketMine/crashdumps/Wed_Apr_26-21.18.46-UTC_2017.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can. I don't know why. Thats the code: PHP: public function Receive(DataPacketReceiveEvent $event){ $packet = $event->getPacket(); if ($packet instanceof PlayerActionPacket) { $this->plugin->getLogger()->warning("DataPacket: PlayerActionPacket was received with action id: " . $packet->action); }} Thanks.
PHP: <?phpnamespace StuckDexter;use pocketmine\plugin\PluginBase;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\event\player\PlayerMoveEvent;use pocketmine\event\server\DataPacketReceiveEvent;use pocketmine\level\Position;use pocketmine\math\Vector3;use pocketmine\block\Block;class lg extends PluginBase implements Listener{public $prefix = "§7[§5Lobby§7]§r ";public function onEnable(){$this->getLogger()->info($this->prefix."§awurde aktiviert");$this->getServer()->getPluginManager()->registerEvents($this, $this);}public function onDisable(){$this->getLogger()->info($this->prefix."§4wurde deaktiviert");}public function Receive(DataPacketReceiveEvent $event){ $packet = $event->getPacket(); if ($packet instanceof PlayerActionPacket) { $this->plugin->getLogger()->warning("DataPacket: PlayerActionPacket was received with action id: " . $packet->action); }}}?>
You gave us not the full file that throws an error. Bug somewere in removed part. Looks like there is extra "}"
@udwarf I cutted it, but it also doesn't work on my server. Is the problem that I use a localhost server without PortForwanding?
So, you've cutted the reason of the error.Check it by yourself for extra brackets (}) if you afraid to share an original file
Uh, anything written after the closing tag isn't interpreted as PHP, so unless you haven't written your syntax properly(i.e. forgetting a closing brace when ending the class), it wouldn't cause any syntax errors as far as I'm aware. But yes, the best practice is to omit the closing tags.
This forum is not for PHP support. Please use StackOverflow for that. See also this useful page for syntax errors: http://stackoverflow.com/q/18050071/3990767