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

get sign lines on touch

Comments in 'Plugin Development' started by mamayadesu, Jul 21, 2015.

  1. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    How I can get sign lines on touch?
  2. BlackJIeB
    Offline

    BlackJIeB New Member

    Joined:
    Oct 12, 2014
    Posts:
    28
    Minecraft User:
    BlackJIeB
    PHP:
        public function SignName(PlayerInteractEvent $event) { //Function touch
            
    if ($event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68) { //definition of sign
                
    $sign $event->getPlayer()->getLevel()->getTile($event->getBlock());
                if (!(
    $sign instanceof Sign)) {
                    return 
    true;
                }
                
    $sign $sign->getText();
                if (
    $sign[0] == "text line 1") { //text line 1
                    
    if ($sign[1] == "text line 2") { //text line 2
                        
    if ($sign[2] == "text line 3") { //text line 3
                            
    if ($sign[3] == "text line 4") { //text line 4
                                
    $player->getInventory()->setChestplate(Item::get(30301)); //your function
                                
    if ($event->getPlayer()->isOp()) {//definition of op
                                    
    return true;
                                }
                                
    $event->getPlayer()->sendMessage("[@] You must be an OP to make sign"); //text if you don't op
                                
    return false;
                            }
                        }
                    }
                }
            }
            return 
    true;
        }
    Last edited: Jul 21, 2015
    mamayadesu likes this.
  3. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    Thanks )
    BlackJIeB likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Block IDs are never greater than 255 :/
    Legoboy0215 likes this.
  5. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    So only need:
    $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68
    PEMapModder and Legoboy0215 like this.
  6. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    I HATE
    PHP:
    $event->getBlock()->getID() == 323
    !!!!!!!!!!!!

Share This Page

Advertisement