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

On player Join activate effect

Comments in 'Plugin Development' started by GamesLoad, Apr 10, 2015.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello I wanted to know how do i run a command when the player enters can not figure out how to control the player that comes when he has to run the command.
    Last edited: Apr 10, 2015
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    riferimi?
    Last edited: Apr 10, 2015
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello I wanted to know how do i run a command when the player enters can not figure out how to control the player that comes when he has to run the command.
    error google translete
  4. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    $this->getServer()->dispatchCommand(new ConsoleCommandSender"command");
    Make sure to import/use ConsoleCommandSender and don't use /.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That's considered as bad practice.
    hoyinm14mc, EnderLight and LDX like this.
  7. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Use JoinCommands plugin
    Praxthisnovcht likes this.
  8. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    use pocketmine\entity\Effect;

    public function effects(PlayerJoinEvent $e) {
    $player = $e->getPlayer();
    $effect = Effect::getEffectByName("Regeneration"); // Regeneration is name of effect
    $effect->setDuration(400)->setAmplifier(1); // 400 = ticks (seconds * 20) and 1 = data
    $player->addEffect($effect);
    }
    hoyinm14mc, PEMapModder and LDX like this.
  9. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    701
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    0.11.0 will give a new feature to JoinCommand: p
    PixelGuy75 and TonyDroidd like this.
  10. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    public function onJoin(PlayerJoinEvent $event){
    $p = $event->getPlayer();
    $effect = Effect::getEffect(Effect::SPEED); //kind of effect
    $effect->setVisible(true);
    $effect->setAmplifier(1);
    $effect->setDuration(20 * 60 * 3); //time
    $p->addEffect($effect);
    }

    Simple and easy
    asyven and TonyDroidd like this.
  11. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    Yea! That works :D
    EnderLight, xiaoq and Praxthisnovcht like this.
  12. EnderLight
    Offline

    EnderLight New Member

    Joined:
    Dec 2, 2014
    Posts:
    7
    Minecraft User:
    enderraian
    is there a command that you can run or do you log it to the console
  13. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    /effect
  14. EnderLight
    Offline

    EnderLight New Member

    Joined:
    Dec 2, 2014
    Posts:
    7
    Minecraft User:
    enderraian
    i know how to add an effect but how do you add to all players when they join server
  15. EnderLight
    Offline

    EnderLight New Member

    Joined:
    Dec 2, 2014
    Posts:
    7
    Minecraft User:
    enderraian
    is it like a command in console my server is new and deleted my old 1 and always thought that i nobody would join cause only my friends joined and they were opped we did all that building for nothing it's because everyone was playing on other servers
    so i plan to make this one a whole lot better in out last one it was parkour creative teleport and just econmy and mine resets
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    JoinCommands, or something like that. I think there exists such plugin.
    GamesLoad likes this.

Share This Page

Advertisement