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

Help!

Comments in 'Plugin Development' started by mamayadesu, Feb 22, 2015.

  1. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    Why it doesn't works?
    File: /src/mamayadesu/secureaccount/secureaccount.php
    PHP:
    <?php

    namespace mamayadesu\secureaccount;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\player\PlayerPreLoginEvent;

    class 
    secureaccount extends PluginBase implements Listener{

    public function 
    onEnable()
        {
            
    $this->getLogger()->info("SecureAccount by MamayAdesu enabled!");
        }
       
    public function 
    onPlayerLogin(PlayerPreLoginEvent $event)
        {
            
    $player $event->getPlayer();
            if(
    strtolower($player->getName()) == "my nickname")
            {
                
    $player->kick("Account is secured!");
                
    $this->getLogger()->info($player->getName()." was kicked from server!");
                return 
    true;
            }
        }
    }
    File: /plugin.yml
    Code:
    name: SecureAccount
    author: MamayAdesu
    api: 1.2.0
    version: "1.0"
    main: mamayadesu\secureaccount\secureaccount
    Works only onEnable()
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You have to registerEvents()
    iJoshuaHD likes this.
  3. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    oh. Thank you very much!!

Share This Page

Advertisement