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

Sign getline?

Comments in 'Plugin Development' started by GamesLoad, May 3, 2015.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello I wanted to know how can I do that if the first line is written [hello] is the player presses it should something happen I would also like to know whether we wrote [hello] in the first line in the second to write something else
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    public function onSignClick(PlayerInteractEvent $event){
    $player $event->getPlayer();
    $sign $player->getLevel()->getTile($event-getBlock());
    if(
    $event->getBlock()->getId() == 323 || $event->getBlock()->getId() == 63 || $event->getBlock()->getId() == 68){ //Sign on wall, ground or Item
    if($sign instanceof Sign){
    $text $sign->getText(); // Text on the Sign
    if($text[0] == "[Hello]"){ //Text[0] = 1st Line, if the text on it is [Hello]
    $player->sendMessage("Hey!");
    }
    }
    }
    }
    Written on Phone, sorry for bad looking code!
    Last edited by a moderator: May 3, 2015
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    ok tankyou
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    A block ID would never be an item ID.
    Also, it is faster to confirm it is a sign before trying to get the tile.
    CraftYourBukkit likes this.
  5. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    But if I would do that if the line we wrote [TURFWARS] then the second line there will have to be written to the online player online from another server as I do
  6. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    If you wanna know how get the Players of another Server, have a look at this post. To update the Sign, may use a Task.

Share This Page

Advertisement