Hello, today I am here for a tutorial on just how to set custom join messages to specific players! So first off you need to have [New API]DevTools installed, next run your server then stop it. Go into your plugins folder and create a folder called CustomJoining then open the folder, create another folder called src then in that folder create a folder with your minecraft username, and last create a folder with the plugin name. (In this tutorial it is CustomJoining). Now open up the IDE you use that ha s php linked with it (You can program in php with it) then create a new project from existing source. Now locate the CustomJoining folder in plugins. Now select that folder and press open, then it should show up in your IDE. Now Press Finish. Next go into your src folder, then your username folder, and last into CustomJoining folder. create a file called CustomJoining.php. Now onto some code. First up we need to make the start look like this: PHP: <?phpnamespace sebagius7110\CustomJoining;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;class CustomJoining extends PluginBase implements Listener{} Now replace sebagius7110 with your username. Now we need to add our first function/method (NOTE this is a very important method/function). Add between the first {} this: PHP: public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("Everything loaded!"); } The file should look like this: PHP: <?phpnamespace sebagius7110\StaffJoin;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;class StaffJoin extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("Everything loaded!"); Now to explain what onEnable does and what the code inside it does. Ok the function onEnable runs the code that is inside onEnable when the plugin is enabled. The first line in it: PHP: $this->getServer()->getPluginManager()->registerEvents($this, $this); It just registers and enables the events. This line: PHP: $this->getLogger()->info("Everything loaded!"); Just prints a message to the console saying Everything loaded when it is done the above code. Now next we add PHP: function onJoin(PlayerJoinEvent $event) {} And inside it we need to add: PHP: $player = $event->getPlayer();$name = $player->getDisplayName(); Now this part is case sensitive, we are just going to set it for a player: PHP: if ($name == "sebagius7110") { Server::getInstance()->broadcastMessage("[SebaCrafty] Guys The Owner Joined The Game! [Owner]sebagius7110"); } Now what this does is when sebagius7110 joins it will say to the chat [SebaCrafty] Guys The Owner Joined The Game! [Owner]sebagius7110 What you can do is replace the sebagius7110 with your name. And maybe delete the [SebaCrafty] Part too. Now if you want to add another username, you can do the same thing but, it needs to be PHP: else if ($name == "") {} Instead of 'if'. Now if you want custom joining messages for other players, do this: PHP: else {Server::getInstance()->broadcastMessage("Guys ".$name." Joined The Game!");} Now the file should look like this: PHP: <?phpnamespace sebagius7110\CustomJoining;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;class StaffJoin extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("Everything loaded!"); } } function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $name = $player->getDisplayName(); if ($name == "sebagius7110") { Server::getInstance()->broadcastMessage("[SebaCrafty] Guys The Owner Joined The Game! [Owner]sebagius7110"); } else { Server::getInstance()->broadcastMessage("Guys".$name."Joined The Game!"); } } Now something else important. We need to create a plugin.yml file. Now where you see all the files in your project in your IDE, right click the Include Path and click on properties. A window should pop up and then press the private tab. Press Add folder, now download the pocketmine-MP-master from github. Extract the zip into a folder, then in the IDE where you need to select a folder, find the pocketmine-MP-master folder then add it. All your errors should go away. Now where your files are in the IDE you need to right click the 'Source Files' Folder and press New, then Other then press the Other File. Next find YAML File and double click that, copy and paste this into the file: Code: name: CustomJoining main: sebagius7110\CustomJoining\CustomJoining version: 1.0.0 api: 1.1.0 Like that, with the to CustomJoining\CustomJoining and replace sebagius7110 with your username. Now save everything, run your server and DevTools should load your plugin, next type in the console 'makeplugin CustomJoining' Without the quotes. It will make your plugin now, stop the server. Cut the folder CustomJoining from your plugins folder, to another place away from your server. Now go into the Dev Tools folder, there should be a .phar file called CustomJoining_v1.0.0.phar move that file from DevTools to your plugins folder, then run your server again. The plugin should be loaded, and now when you join the game, it will say the message you set in the code for your username. (Notice that it will still say <username> Joined The Game but it will say Guys The Owner Joined The Game: [Owner]<username>) Hope this tutorial helps, and sorry if it is toooooo long, but hope this helps, thanks -Seb P.S. If you want a tutorial on a different event too, post in the comments and I will try to make a tutorial.
Just as a note, you can also use $this->getServer()->broadcastMessage() instead of Server::getInstance(). This isn't an issue, but its another way.
Anyway, I think this tutorial is after all too generic. This tutorial is just basically explaining what a custom join plugin contains, but you taught nothing about how it works. You are just like saying, "to cook a steak, buy some from the market and cook at at home and do i-dont-really-know-how blah blah. If you want to cook pork chop instead, tell me here and I will add that tutorial. If you want to cook anything else than steak, I will make another tutorial." And do you think this teaches one how to cook? No. You barely taught him how to cook steak, and the reader doesn't even know why you have to cook. Instead, you should teach the readers the basics, like the kitchen hygiene, and let them figure out that it is the same for pork chop. In our case, you should teach people why they have to do all these stuff. From what I see you have done, it is just the same as you made a custom join plugin and told people how to modify it to suit your own needs.
DevTools Wont Load The Source Plugin [INFO] Loading source plugin CustomJoining v1.0.0 10:31:14 [WARNING] An E_USER_WARNING error happened: "Couldn't load source plugin CustomJoining: main class not found" in "/DevTools_v1.8.0-4c37f602.phar/src/FolderPluginLoader/FolderPluginLoader" at line 72 10:31:14 [CRITICAL] Could not load plugin 'CustomJoining'
This is so complicated if you don't have the final .phar And BTW LDX told me for this command: Player::sendPopup() And guess what it does! I recommend you to replace the Server::getInstance() with that one.
And what do you mean by Player::sendPopup? It does something totally different from Server::getInstance... And it is a function not a command...