Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved How to send a command when a player joins?

Comments in 'Plugin Development' started by Jankirby, Apr 8, 2016.

  1. Jankirby
    Offline

    Jankirby Active Member

    Joined:
    Apr 20, 2014
    Posts:
    38
    Minecraft User:
    Natsu_Dragneel
    So yeah, i started developing plugins and quite not know much,

    so far i have this code

    PHP:
    <?php

    namespace TPVoid;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\player\PlayerJoinEvent
    use pocketmine\command\ConsoleCommandSender

    class TPVoid extends PluginBase implements Listener{
     
      public function 
    onJoin(PlayerJoinEvent $event){
       
    $player $event->getPlayer();
       
    $name $player->getName();
    So how do you execute a command as console when a player joins the game?
    Really sorry for the dumb question
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Avoid executing a command in plugins. Always do it directly if it is possible. It is a bad practice to (it seems like you want to) run "/tp player" on console rather than directly using the Player::teleport() function to teleport the player.

    Am I guessing it correctly?
  3. Jankirby
    Offline

    Jankirby Active Member

    Joined:
    Apr 20, 2014
    Posts:
    38
    Minecraft User:
    Natsu_Dragneel
    Yes, thank you for the answer, learned again from you sir.
    applqpak likes this.

Share This Page

Advertisement