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

help deveploping my first plugin

Comments in 'Plugin Development' started by jerlegoman, Jun 8, 2014.

  1. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Ok, i agree.
  2. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    BTW, thanks for following me.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The event name is player.block.touch
    xktiverz likes this.
  4. FunneyShip
    Offline

    FunneyShip Active Member

    Joined:
    Jun 7, 2014
    Posts:
    36
    Minecraft User:
    FunneyMan
    He wants if you are HOLDING a complass not touching a block with compass (i think) but for holding it should be player.equpment.change
  5. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Why is everyone developing and learning in the old API?
    PEMapModder likes this.
  6. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    Because I like the old API sill and my PE server uses it
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  8. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    is the if statment return false; or return true;
  9. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    I learned this on php.net
    PHP:
    <?php
    if ($a $b)
      echo 
    "a is bigger than b";
    ?>
    So i was thinking maybe i could do this:
    PHP:
    public function touch($data) {
    if
    $data["item"]->getID() == 345) {
    echo 
    $this->api->console->run("spawn");
    Would this be correct or if it isnt how should i do it?
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes if you close the curly braces.
  11. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    What does the that code have to do with the thing you learnt on PHP?
  12. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    Because I now know how to make the code properly
  13. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    <?php
    /*
    __PocketMine Plugin__
    name=TOspawn
    version=1.0
    apiversion=12
    author=Jerlegoman
    class=spaplus
    */
    class spaplus implements Plugin {
    private $api;
    public function __construct(ServerAPI $api,$server = false) {
    $this->api = $api;
    }
    public function init() {
    $this->api->addHandler("player.action",array($this,"touch"));
    }
    public function touch($data) {
    if($data["item"]->getID() == 345) {
    $data->teleport(this->server->spawn);
    }
    }
    public function __destruct() { }
    }
    ?>

Share This Page

Advertisement