Hi im new to plugin development and so far i made this: PHP: <?phpnamespace MhikeiMPC12\customJoinMessages;use pocketmine\plugin\PluginBase; //Allows the plugin to use the files in /src.use pocketmine\plugin\PluginLoader; //Allows the plugin to listen for an event, which triggers an actionuse pocketmine\command\Command;use pocketmine\event\PlayerQuitEvent;use pocketmine\event\PlayerJoinEvent;class CustomJoinMessages extends PluginBase{ public function onLoad(){ $this->getLogger()->info("CustomJoinMsgs has been loaded!"); } public function onEnable(){ $this->getLogger()->info("CustomJoinMsgs has been Enabled!"); } public function onDisable(){ $this->getLogger()->info("CustomJoinMsgs has left :P"); } public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch($command->getName()) { case "cusjoinmsg": // do stuff return true; case "cusquitmsg": if (count($args) == 0 ){ return false; } var_dump($args); // do stuff return true; } }} Its a plugin that allows the user to set a custom join and quit message. Its not finished, though.
I think the code is in its syntax correct, but you forgot to implement CommandSender (you have only implemented Command yet).
Ok, i changed it so you can only set the messages using the config only. PHP: <?phpnamespace MhikeiMPC12\customJoinMessages;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;use pocketmine\event\Player\PlayerQuitEvent;class CustomJoinMessages extends PluginBase{ public function onLoad(){ $this->getLogger()->info("CustomJoinMsgs has been loaded!"); } public function onEnable(){ $this->getLogger()->info("CustomJoinMsgs has been Enabled!"); $this->saveDefaultConfig(); $this->reloadConfig(); } public function onDisable(){ $this->getLogger()->info("CustomJoinMsgs has left :P"); } function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $name = $player->getDisplayName(); }}
Why do you need to implement CommandSender? And Command is a class, not an interface. How can you implement Command? Or if your definition of "implement" is to carry out something, I don't see how it is related to the code in the OP.
Wrong. This has no sense at all. Wrong. This is totally not related with events. And this line can be deleted safely.
That's called alias declaration, or importing, or namespace-using, or macro-defining, or creeper-killing, or PocketMine-third-party-version-creating, or whatever you want to call that doesn't duplicate the term for something that technically exists and can be totally mistaken for another meaning. Implementing a type has another meaning (declare a class as an implementation of an interface), and you must not mix it with declaring an alias for a type. They are both verbs, and they both accept a type as an object, so they can be totally confused.
Why you are making a new plugin? There are two plugins in Pocketmine that makes custom join and left messages. And pocketmine.yml allows you to change the join and leave message, and even choosing if you want to display it like a tip, popup or a message.
If you can't even make a private plugin like that, nobody can follow the Android developer training website to make a simple Hello World app anymore. https://developer.android.com/training/basics/firstapp/index.html