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

Sign Help.

Comments in 'Plugin Development' started by NIM, Jan 9, 2014.

  1. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    I've been currently learning, and messing around with the Tile API, as I want to be a developer dedicated to live signs etc.

    I have currently created a test plugin to see if I have any knowledge, can anyone tell me if its right or whats wrong?
    The plugin is supposed to return "HELLO" if you tyope "hi" on the first line.
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Sgins at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "hi")
                      return;
                              
    $data->data['Text1'] = "HELLO";
                                }
                            }
                        }
                      }
                        public function 
    __destruct(){
        }
        }
  2. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Did you try running it?
  3. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    OMG!!!!!! If this works, I will will be happy forever!!!!!! You can make awesome plugins like Command book off of this code
    Last edited: Jan 9, 2014
  4. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    1-9-2014 6-09-25 PM.png
  5. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Try this.
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Sgins at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "hi")
                      return;
                              
    $data->data['Text1'] = "HELLO";
                                }
                            }
                        }
                       public function 
    __destruct(){
        }
        }
  6. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    I have lots in mind :)
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I am making a new plugin package called DST
    DST for DynamicSignTechnology
    A main API for registering/removing dynamic signs
    Some handlers, acting like a pocketmine API
    And a plugin with something like SignConsole improved
    And a sign signer and op protection
    May support Permissionsplus
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Sounds fancy :p
  9. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    @NIM how can I use your plugin? Are there any instructions? xD
  10. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    ok..... so it works, BUT ONLY PARTIALLY! You have to long in and log off for it to work.

    i uploaded a video.....
  11. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
  12. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    That is a very good sign that I'm getting close, I will fix and send you a copy, standby
  13. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    It's currently a test plugin, its for no need :/
  14. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    Ok! And once this code is finished, can we co-found a plugin together? I am also experienced in pocketmine php code. We can give suggestions to each other!
  15. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Sgins at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "hi")
                      return;
                              
    $data->setText("HELLO"$data->data['Text1'])
                                }
                            }
                        }
                       public function 
    __destruct(){
        }
        }
    Try This.
  16. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
  17. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    1-10-2014 3-56-19 PM.png
  18. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "hi")
                      return;
                              
    $data->setText("HELLO"$data->data['Text1']);
                                }
                            }
                        }
                     }
                       public function 
    __destruct(){
        }
        }
    It was a simple fix, I hope :)
  19. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    1-10-2014 5-20-42 PM.png
  20. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
     private 
    $api$server;
     public function 
    __construct(ServerAPI $api$server false){
     
    $this->api $api;
     
    $this->server ServerAPI::request();
     }

     public function 
    init(){
     
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
     }

     public function 
    eventHandler($data$event){
     switch (
    $event) {
     case 
    "tile.update":
     if (
    $data->class === TILE_SIGN) {
     if (
    $data->data['Text1'] != "hi")
     return;
     
    $data->setText("HELLO"$data->data['Text1']);
     }
     }
     }
     public function 
    __destruct(){
     }
     }
    Oops, we go!

Share This Page

Advertisement