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

Join Signs?

Comments in 'Plugin Development' started by TheMadGamer, Aug 19, 2015.

  1. TheMadGamer
    Offline

    TheMadGamer New Member

    Joined:
    Aug 18, 2015
    Posts:
    6
    Minecraft User:
    TheMadGamer
    Mhhh i want to know how to make join signs for a minigame but everytime i try it dosent work i am not quite sure if that the way i have to do it, can someone please tell me or post the right way

    Thank You
    GuddaJ likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You need to define what a game is. It is not as simple as a sign. It involves the management of games.
    CrazedMiner and Legoboy0215 like this.
  3. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    The basic code to see if a sign has a specific text on a certain line is
    PHP:
    public function onInteract(PlayerInteractEvent $event) {
            
    $player $event->getPlayer();
            
    $sign $event->getPlayer()->getLevel()->getTile($event->getBlock());
            if(
    $event->getBlock()->getId() == 63 or $event->getBlock()->getId() == 68) {
                if(
    $sign instanceof Sign) {
                    
    $signtext $sign->getText();
                    if(
    TextFormat::clean($signtext[0]) === "[1v1]") {//Change "[1v1]" to what ever you want to detect on the first line of the sign
                        //Do stuff here
                    
    }
                }
            }
        }
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Actually, you don't need to check the block.
  5. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Don't need to but I do it, so it doesn't check that every block is instanceof Sign :p
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    instanceof Sign causes much less lag compared to the getTile call.
    CraftYourBukkit and CrazedMiner like this.
  7. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    instanceof Sign still requires you to get the tile....
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes, but you should instead check whether it is a sign block before you get the tile.
    CraftYourBukkit likes this.

Share This Page

Advertisement