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

[New API] Signs...

Comments in 'Plugin Development' started by Sensej, Aug 5, 2014.

  1. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    Hello great coders,
    Can somebody makes a code:
    If a player interact to a sign that i can get the text of this sign??

    Best Regards Sensej
  2. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    U can already do that you go in folder world open the folder on witch world u wanna check the signs and open tiles.yml you'll find which player wrote it and what it says (I'm pretty sure if they delete the sign it will still be saved)
    I'm happy to help
    -Wantedkillerss
  3. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    Sorry i mean i want to replace the text:
    if($this->sign->gettext($line[1] == "test");
    {
    $this->sign->setText($line[1] = "Work");
    }
  4. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Oh why?
  5. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    so i want use it as a Monitor to see how many players are online but worldmonitor doesent work so i ask here
  6. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    But this is useless do /list or go in the settings it shows how many players are there in your server
  7. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    You dont understand me ;)
    PEMapModder and LDX like this.
  8. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    This was only an example
  9. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Get the Tile of a sign, and use the function getText() which will return a array of each line on the sign
  10. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    ok why did not work?

    PHP:
    public function playerBlockTouch(PlayerInteractEvent $event
        {
                
    $blockid $event->getBlock()->getID();          
                if(
    $blockid == 323 || $blockid == 63 || $blockid == 68
                {
                    if(
    $tile instanceof Sign)
                    {
                        
    $sign->getText();
                        if(
    $t[0] == "test")
                        {
                        
    $tile->setText($t[0], "ok");
                        }
                    }
                }
        }
  11. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Did u transfer it into a phar file? And what is u are trying to do with this cause its kinda hard to help without even knowing what you're doing and what error did the console give u?
  12. Sensej
    Offline

    Sensej New Member

    Joined:
    Aug 5, 2014
    Posts:
    64
    1: DevTools can read plugin files (reading sourcecode)
    2. I want a code which search signs with the text on line 1 with [Status] and add text on line 2 with the playerscount ([Status] 20/25) and if you tap them (playerinteract event) it will run my code
  13. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    The Tile variable isn't defined, get the Tile by using $event->getBlock()->getLevel()->getTile($event-getBlock()->getX(), $event-getBlock()->getY(), $event->getBlock()->getZ()); or something like this I can't remember what exact
    PEMapModder likes this.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He asked how to do it in PHP, not how to do it manually.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The error in his snippet is obvious enough.
    Last time, $event->getBlock()->getLevel()->getTile($event->getBlock()) is ok enough. Also getTile() must be given a Vector3 instance not three numbers.
  16. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Ok
  17. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Ye forget about this, wrote that message at 1 am and was really tired :3
    PEMapModder likes this.

Share This Page

Advertisement