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

Solved Sign Format

Comments in 'Plugin Development' started by Taha_The_Hacker, Sep 19, 2015.

  1. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    He probably didn't register events :p
    EvolSoft and Legoboy0215 like this.
  2. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I code this right now.

    Only read it and read the comments, is exactly what are you looking for.

    *Edited.
    I forgot register events x) Now it works

    PHP:
    <?php

    namespace example\example;

    use 
    pocketmine\event\block\SignChangeEvent;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginBase;

    class 
    Main extends PluginBase implements Listener{
        public function 
    OnEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getLogger()->info("Enabled");
        }

        public function 
    OnDisable(){
            
    $this->getLogger()->info("Disabled");
        }

        public function 
    OnSignChange(SignChangeEvent $event){
            
    $player $event->getPlayer();
            if(
    strtolower(trim($event->getLine(0) == "[EXAMPLE]"))){      #If line 1 have "[EXAMPLE]" and $player has the permission the lines will change
                
    if($player->hasPermission("permexample.blabla")){
                    
    $event->setLine(0"Hi"); #Line 1
                    
    $event->setLine(1"My name is");  #Line 2
                    
    $event->setLine(2"Pedro"); #Line 3
                    
    $event->setLine(3"And I sell bananas"); #Line 4
                
    }
            }
        }
    }
    Taha_The_Hacker likes this.
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Sorry for you, too late.i fixed it the same way you did, ( i am not lying) :p
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    But i can like the post.
  6. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Dude, we already know you can't code, so you might as well stop faking...
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    That isn't Fake.
  8. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    This is what you said on GitHub:
    Owner
    TahaTheHacker commented 4 hours ago
    Yes, i copy and paste some codes, but then i change them as my code is working.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    **sigh**
    This community is getting into a total mess.
    What is the human race heading towards...
    Taha_The_Hacker likes this.

Share This Page

Advertisement