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

Need help with setting sign/tile text!

Comments in 'Plugin Development' started by iiDeathStrokeii, May 2, 2015.

  1. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    Hi guys im having trouble setting sign text heres my code used:
    PHP:
    public function onPlayerInteract(PlayerInteractEvent $event){
                
    $p $event->getPlayer();
               
                
    $tile $event->getBlock()->getLevel()->getTile($event->getBlock());
                if (
    $tile instanceof Sign) {
                    
    $tiles $tile->getText();
                     if (
    $tiles[0] == "[CloudPvP]" and $tiles[1] == "Spleef"){
                         
    $tile->setText($tiles[0], $tiles[1], $this->SpleefOne->get("Spleef_One_In_Progress"), $this->SpleefOne->get("Spleef_One_Players"));
                         if (
    $this->SpleefOne->get("Spleef_One_In_Progress") == false and $this->SpleefOne->get("Spleef_One_Players") < 8){
                           
                              
    $p->sendMessage($this->SpleefOne->get("Join-Spleef-One-Message"));
                              
    $this->SpleefOne->get("Spleef_One_Players");
                             
                          }
                     }
                }
            }

    (yaml)

    Code:
    ---
    Join-Spleef-One-Message: §c[Spleef]§eJoining Spleef Lobby One!
    Spleef_One_Players: 0
    Spleef_One_In_Progress: false
    SpleefOnePlayerOne: ~
    SpleefOnePlayerTwo: ~
    SpleefOnePlayerThree: ~
    SpleefOnePlayerFour: ~
    SpleefOnePlayerFive: ~
    SpleefOnePlayerSix: ~
    SpleefOnePlayerSeven: ~
    SpleefOnePlayerEight: ~
    ...
    
    THE OUPUT THE PHP ABOVE IS BELOW IN THE IMAGE.

    [​IMG]

    I want it to say 0/8, how do I add "/8"?
    everything i tried just crashed the server :p help would be appreciated!
  2. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    FULL SIZE IMAGE:
    [​IMG]
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    public function onPlayerInteract(PlayerInteractEvent $event){$p $event->getPlayer();
     
    $tile $event->getBlock()->getLevel()->getTile($event->getBlock());
     if (
    $tile instanceof Sign) {$tiles $tile->getText();
     if (
    $tiles[0] == "[CloudPvP]" and $tiles[1] == "Spleef"){$tile->setText($tiles[0], $tiles[1], $this->SpleefOne->get("Spleef_One_In_Progress"), $this->SpleefOne->get("Spleef_One_Players") . "/" $this->SpleefOne->get("max-players")); //Try like that but I'm not sure if it works. Of course you have to add max-players to the config :D
     
    if ($this->SpleefOne->get("Spleef_One_In_Progress") == false and $this->SpleefOne->get("Spleef_One_Players") < 8){
     
    $p->sendMessage($this->SpleefOne->get("Join-Spleef-One-Message"));$this->SpleefOne->get("Spleef_One_Players");
     
     }
     }
     }
     }
  4. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    Thanks :) I will try this!
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1You should use a numeral-key array for arenas. It isn't a good idea to have one field per arena.

    Wait, why are you using a config? Why don't you just make fields? You don't need a config to save temporary data.
    iJoshuaHD likes this.

Share This Page

Advertisement