I am new to plugin dev and can not get my first plugin to work properly. I need help! .zip file included that contains the code for my plugin. I get this error when i use the .zip to phar converter by PeMapModder: Classpath Inspection result: Passed Info Main class scanned: Tutorial\MainClass Main class file found at src/Tutorial/MainClass.php Bad practice Inspection result: Passed Syntax errors Inspection result: Error Errors Could not open input file: /var/www/tmp/5/Tutorial Info 0 good PHP file(s) and 1 bad PHP file(s) found. Checked with PHP 5.6.11-1+deb.sury.org~trusty+1 Error is in bold print. Please help me I am new to plugin dev!
still get: Syntax errors Inspection result: Error Errors Could not open input file: /var/www/tmp/5/Tutorial Info 0 good PHP file(s) and 1 bad PHP file(s) found. Checked with PHP 5.6.11-1+deb.sury.org~trusty+1 when i compile it. Will test on my server.
change: public function onCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, $label, array $args) To: public function onCommand(CommandSender $sender, Command $command, $label, array $args){ and add use pocketmine\command\CommandSender; under namespace
I already added the use pocketmine\command\CommandSender and it is set as public function onCommand (CommandSender $sender, Command $command, $label, array $args) already
PHP: <?phpnamespace Tutorial;use pocketmine\plugin\PluginBase;use pocketmine\command\CommandSender;use pocketmine\command\Command;use pocketmine\utils\TextFormat as Color;use pocketmine\Player;class MainClass extends PluginBase{ public function onEnable() { $this->getLogger()->info(Color::GREEN. "[HAW] HAW has been enabled"); } public function onDisable() { $this->getLogger()->info(Color::GREEN. "[HAW] HAW has been enabled"); } public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if($sender instanceof Player) { $name = $sender->getName(); if($strtolower($command->getName()) === "tutorial") if(count($args) < 1) { $sender->sendMessage(Color::GOLD. "[Server] Hello $name welcome to our server!") ; return; } else { $sender->sendMessage(Color::RED. "[Server] sorry $name this command doesn't need arguments") ; return; } } $sender->sendMessage(Color::RED. "[HAW] You must be a player to execute this command!") ; return; }} --- name: Tutorial author: Hittmana main: Tutorial\MainClass version: 1.0.0 api: [1.12.0] description: Test plugin command: tutorial: description: Send a message to the user permission: tutorial.cmd permissions: tutorial.cmd: default: true description: "Send a message to the user" ...
the main problem is I keep getting this error: Errors Could not open input file: /var/www/tmp/5/Tutorial and i do not even have a file /var/www/tmp/5/Tutorial