I recommend using 2.1.0 if you want to use newer features like PlayerToggleFlightEvent. Usually this would be the case, but we've been forced to make so many changes it might not hold true this time. This is why I bumped to 3.0.0-ALPHA1 for 1.0.
What exactly, I can't find the error in plugin.yml PHP: name: AFKCommandmain: ZakousseMC\Mainversion: 1.0.0api: [2.0.0, 2.1.0]description: Adds an /afk command that let you /afk. This is my first plugin.website: https://darknightpe.comauthor: ZakousseMCcommands: afk: description: Vous rendre AFK. usage: "/afk" permission: afk.command.afk permissions: afk: default: op description: "Vous laisse utiliser toutes les commandes que le plugin a." children: afk.command: description: "Vous laisse utiliser la commande /afk" default: true
I changed the plugin.yml a bit : PHP: name: AFKCommandmain: zakoussemc/afkplugin/mainversion: 1.0.0api: [2.0.0, 2.1.0]description: Adds an /afk command that let you /afk. This is my first plugin.website: https://darknightpe.comauthor: ZakousseMCcommands: afk: description: Vous rendre AFK. usage: "/afk" permission: afk.command.afk permissions: afk: default: op description: "Vous laisse utiliser toutes les commandes que le plugin a." children: afk.command: description: "Vous laisse utiliser la commande /afk" default: true And the Main.php file is in "afkplugin"
I have fixed your plugin for you. Spoiler: plugin.yml Code: name: AFKCommand main: zakoussemc\afkplugin\Main version: 1.0.0 author: ZakousseMC api: 2.0.0 load: POSTWORLD description: Adds an /afk command that let you /afk. This is my first plugin. website: https://darknightpe.com commands: afk: description: Vous rendre AFK. usage: "/afk" permission: afk.command.afk permissions: afk: default: op description: "Vous laisse utiliser toutes les commandes que le plugin a." children: afk.command: description: "Vous laisse utiliser la commande /afk" default: true Corrected your PHP too... Spoiler: Corrected PHP PHP: <?phpnamespace zakoussemc\afkplugin;use pocketmine\command\Command;use pocketmine\command\CommandExecutor;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\Server;use pocketmine\utils\Config;use pocketmine\utils\TextFormat;class Main extends PluginBase {public function onEnable() { @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->reloadConfig(); $this->getLogger()->info(TextFormat::RED . "its alive"); } public function translateColors($symbol, $message) { $message = str_replace($symbol."0", TextFormat::BLACK, $message); $message = str_replace($symbol."1", TextFormat::DARK_BLUE, $message); $message = str_replace($symbol."2", TextFormat::DARK_GREEN, $message); $message = str_replace($symbol."3", TextFormat::DARK_AQUA, $message); $message = str_replace($symbol."4", TextFormat::DARK_RED, $message); $message = str_replace($symbol."5", TextFormat::DARK_PURPLE, $message); $message = str_replace($symbol."6", TextFormat::GOLD, $message); $message = str_replace($symbol."7", TextFormat::GRAY, $message); $message = str_replace($symbol."8", TextFormat::DARK_GRAY, $message); $message = str_replace($symbol."9", TextFormat::BLUE, $message); $message = str_replace($symbol."a", TextFormat::GREEN, $message); $message = str_replace($symbol."b", TextFormat::AQUA, $message); $message = str_replace($symbol."c", TextFormat::RED, $message); $message = str_replace($symbol."d", TextFormat::LIGHT_PURPLE, $message); $message = str_replace($symbol."e", TextFormat::YELLOW, $message); $message = str_replace($symbol."f", TextFormat::WHITE, $message); $message = str_replace($symbol."k", TextFormat::OBFUSCATED, $message); $message = str_replace($symbol."l", TextFormat::BOLD, $message); $message = str_replace($symbol."m", TextFormat::STRIKETHROUGH, $message); $message = str_replace($symbol."n", TextFormat::UNDERLINE, $message); $message = str_replace($symbol."o", TextFormat::ITALIC, $message); $message = str_replace($symbol."r", TextFormat::RESET, $message); return $message; } // Acces aux permissions.private function access(CommandSender $sender, $permission) { if($sender->hasPermission($permission)) return true; $sender->sendMessage("Vous n'avez pas la permission d'utiliser cette commande."); return false;}private function inGame(CommandSender $sender,$msg = true) { if ($sender instanceof Player) return true; if ($msg) $sender->sendMessage("Vous pouvez seulement utiliser cette commande en jeu."); return false;}public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if(count($args) < 0) $sender->sendMessage(TextFormat::GREEN . "Vous etes desormais AFK."); return false;}} $this->getLogger()->info(TextFormat::RED . "its alive"); This line above can be changed. Simply change the "its alive" with your own message. Make sure its in the folder & file path below: |- plugin.yml | |- src -- zakoussemc -- afkplugin -- Main.php. The names are CASE Sensitive, so be careful.
The part about api is not true. Writing api: 2.0.0 means that you support all API versions with major version (first number) 2 and minor version (second number) at least 0. Also the [] is not necessary because PocketMine will cast them to array. It is of course still good practice to always write them in the correct syntax. I have edited your post to fix this ridiculously false statement.
I know that this isn't what this thread is about, but I just want to say something. It's Kinda long, so read the spoiler. Spoiler I don't think that his post deserves to be labelled as "Ridiculously False" Other, fairly common plugins use the same: https://github.com/LegendOfMCPE/EssentialsPE/blob/master/plugin.yml But that's besides the thing I want to talk about. I don't think it is right to criticize people for what they post. Unless it is intentionally bad or harmful, open public criticism is not the way to help people, at least not in my view. When I first joined the Pocketmine forums, I borked a post I made about Plugins on Github. I didn't realize it was false, so I was super grateful when I saw this in my Conversations inbox: @Intyre was super nice about it, and he let me know privately about my mistake. This prevented me from having to be publicly shamed for the sake of a small error. I know from experience that it can destroy your confidence to have your mistakes made public, and while it can be useful for large, group errors, individual mistakes (In my opinion) could be better solved using individual solution. It not just the post I quoted above, I have seen others, from other people, that are unnecessarily hurtful or rude. I mean, we are all learning on these forums, right? No need to criticize anyone who hasn't learned as much. I just realized I spent over an hour drafting this one response, because I don't want to offend anyone, that certainly is not my intention. I am also not trying to sound like a staff member, because honestly, this is just my two cents about things I have seen recently. Again, I can't stress enough that I don't want to insult anyone, or try to make up my own rules for the forums, I just wanted to get it out there about what I have seen. There are also amazing, awesome things that going in these forums, and I just want to keep (My focus at least) on helping people out.
I agree completely! That example plugin wasn't exactly right though, I shouldn't have kept the 2.0.0 API there, as the vanish stuff messed up in 2.1.0, so I don't think that works fully in 2.0.0 That's kinda my fault.