Plzz editi code for me. Main.php Code: <?php namespace Flsmers; use pocketmine\plugin\PluginBase; use pocketmine\item\Item; use pocketmine\Player; use pocketmine\utils\Config; use oocketmine\inventory\Inventory; use pocketminr\command\ConsoleCommandSender; use pocketmine\command\CommandSender; use pocketmine\command\Command; class Main extends PluginBase{ public function onEnable(){ } $this->getLogger()->info("Zadania zaladowane"); } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ if(strtolower($command->getName('cobblex'))) { if(empty($args)) { $sender->sendMessage(""); $sender->sendMessage("• §9>> §aZdobądz 64 cobblestona §9>> §a/skyblock 1"); $sender->sendMessage("• §9>> §aZdobądz 32 złota §9>> §a/skyblock 2"); $sender->sendMessage("• §9>> §aZdobądz 32 żelaza §9>> §a/skyblock 3"); $sender->sendMessage("• §9>> §aZdobądz 64 diamenty §9>> §a/skyblock 4"); $sender->sendMessage("• §9>> §cWięcej zadań wkrótce :)"); return true; } if($args[0] == "kup") { }else{ if($sender->getInventory()->contains(Item::get(4, 0, 64))){ $sender->getInventory()->addItem(Item::get(388, 0, 1)); $sender->sendMessage("§a • Kupiłeś cobblex • "); } else{ $sender->sendMessage("§c • Nie masz cobblestone'a • "); } } return true; } } } } plugin.yml Code: name: CobblexKup main: Flsmers\Main version: 1.0.0 api: 2.0.0 commands: cobblex: description: "Kupno cobblex" permission: "cobblex.cobblexkup" default: true Thanks
PHP: class Main extends PluginBase{public function onEnable(){}$this->getLogger()->info("Zadania zaladowane");} I have narrowed down where the mistake may be at. Try to find it yourself.
PHP: <?phpnamespace Flsmers;use pocketmine\plugin\PluginBase;use pocketmine\item\Item;use pocketmine\Player;use pocketmine\utils\Config;use oocketmine\inventory\Inventory;use pocketminr\command\ConsoleCommandSender;use pocketmine\command\CommandSender;use pocketmine\command\Command;use pocketmine\event\Listener;class Main extends PluginBase implements Listener{ public function onEnable(){ } $this->getLogger()->info("Zadania zaladowane"); $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ if(strtolower($command->getName('cobblex'))) { if(empty($args)) { $sender->sendMessage(""); $sender->sendMessage("• §9>> §aZdobądz 64 cobblestona §9>> §a/skyblock 1"); $sender->sendMessage("• §9>> §aZdobądz 32 złota §9>> §a/skyblock 2"); $sender->sendMessage("• §9>> §aZdobądz 32 żelaza §9>> §a/skyblock 3"); $sender->sendMessage("• §9>> §aZdobądz 64 diamenty §9>> §a/skyblock 4"); $sender->sendMessage("• §9>> §cWięcej zadań wkrótce :)"); return true; } if($args[0] == "kup") { }else{ if($sender->getInventory()->contains(Item::get(4, 0, 64))){ $sender->getInventory()->addItem(Item::get(388, 0, 1)); $sender->sendMessage("§a • Kupiłeś cobblex • "); } else{ $sender->sendMessage("§c • Nie masz cobblestone'a • "); } } return true; } } }}I dont know wether it is right but I've registered the events and implements the Listener
One main problem you have is the OnEnable here is a corrected one. PHP: class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getLogger()->info("Zadania zaladowane"); $this->getServer()->getPluginManager()->registerEvents($this, $this); } The last "}" for the "class Main extends PluginBase implements Listener{" goes at the bottom of the whole code Ill correct the rest soon
I understand what you mean, but the person who suggested it was also wrong. So I have the right to correct that person. Dont you agree?
Hey! Hope its not too late to point out that little typos make a big diference too. use oocketmine\inventory\Inventory; Look in BOLD for the error oocketmine is the typo. Its supposed to be pocketmine