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

Why not work?

Comments in 'Plugin Development' started by abler98, Nov 16, 2014.

  1. abler98
    Offline

    abler98 New Member

    Joined:
    Nov 15, 2014
    Posts:
    26
    Minecraft User:
    abler98
    Why not work? In theory should bring a test message when clicked.

    PHP:
    <?php namespace Redozote;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerInteractEvent;

    class 
    PrivateTerrain extends PluginBase implements Listener {
        public function 
    onPlayerInteract(PlayerInteractEvent $event) {
            
    $event->getPlayer()->sendMessage('LOL');
        }
    }
  2. Humerus
    Offline

    Humerus Staff Member Plugin Reviewer

    Joined:
    Aug 23, 2013
    Posts:
    114
    Plugins:
    1
    You didn't include any of the functions required for a normal plugin.
    64FF00 likes this.
  3. abler98
    Offline

    abler98 New Member

    Joined:
    Nov 15, 2014
    Posts:
    26
    Minecraft User:
    abler98
    And how to?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You should register the listener at onEnable().

    PHP:
    public function onEnable(){
        
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    }
  5. abler98
    Offline

    abler98 New Member

    Joined:
    Nov 15, 2014
    Posts:
    26
    Minecraft User:
    abler98
    Thanks
  6. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    $event->getPlayer()->sendMessage("LOL");
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    In this case, single and double quotes are the same.
    Xenturio and iJoshuaHD like this.

Share This Page

Advertisement