Hi guys I just have a question what am I doing wrong here I am barely new to coding and hopefully some of you guys can help me out I will send all the error if needed ty! PHP: <?phpnamespace exepx\placeblock;use pocketmine\event\block\BlockBreakEvent;use pocketmine\event\block\BlockPlaceEvent;use pocketmine\network\mcpe\protocol\BlockActorDataPacket;use pocketmine\plugin\PluginBase;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Server;use pocketmine\Player;use pocketmine\utils\TextFormat;use pocketmine\block\Block;use pocketmine\event\Cancellable;use pocketmine\event\Listener;use pocketmine\item\Item;class Main extends PluginBase implements Listener { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TextFormat::DARK_GREEN . "Place block has been enabled!"); } public function onDisable() { $this->getLogger()->info(TextFormat::DARK_RED . "Place block has been disabled"); } public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool { switch ($command->getName()) { case "on": $sender->sendMessage(TextFormat::DARK_GREEN . "You can now place blocks"); return true; case "off": $sender->sendMessage(TextFormat::DARK_RED . "You cant place blocks!"); return true; } }}
hi @jasonwynn10 as of right now my intended outcome is just making it a command but everytime I do it gives me an error on the console and it unloads I will send what error it gives me Code: TypeError: "strpos() expects parameter 1 to be string, int given" (EXCEPTION) in "src/pocketmine/plugin/PluginManager" at line 560 [23:16:14] [Server thread/DEBUG]: #0 src/pocketmine/plugin/PluginManager(560): strpos(integer 1, string[1] :)
I think this has sth to do with the stupidness of yaml replacing "on" with "true". Try naming the command differently.
... no if you look at the actual error posted it says it was an integer, not a string. It actually was what it was, not what it needed to be.