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

To the minigame developers

Comments in 'Plugin Development' started by MyNameIsTriXz, Mar 8, 2016.

  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    I cant create a working sign system, just because there is a big bug: When a player leaves a minigame level "TW-1" and reenters and joins "TW-2", only the sign of "TW-1", gets updated. That makes the whole sign system completely buggy. Do you know this problem too, that the player gives wrong informations? Can you tell me how you made the sign system on your plugin? I am frustating with this bug...
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Show your code, please
    PEMapModder likes this.
  3. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Sign Update on Quit:

    PHP:
    public function LeaveCheck($game){


    // refresh sign text


    foreach($this->sign->getAll() as $pos => $coordstr){


    $coord explode(" "$coordstr);



    $sign $this->getServer()->getDefaultLevel()->getTile(new Vector3($coord[0], $coord[1], $coord[2]));



    $signt $sign->getText();

    if(
    str_replace("§b"""$signt[1]) == $this->games[$game]["Arena"]){

    $s1 str_replace("§"""$signt[3]);
    $s2 str_replace(" """$s1);
    $s3 str_replace("/"""$s2);
    $s4 str_replace("e"""$s3);
    $s5 str_replace("d"""$s4);
    $am str_replace($this->MAX""$s5);

    $am $am 1;

    $game $this->getGameByLevel(str_replace("§b"""$signt[1]));

    if(
    $this->games[$game]["Status"] == "JOINABLE"){

    $sign->setText($signt[0], "§b".$signt[1], $signt[2], "§d".$am."§e / §d".$this->MAX);

    }

    $s $this->games[$game]["Status"];

    if(
    $am 2){
    if(
    $s == "INGAME" || $s == || $s == || $s == || $s == || $s == || $s == 0){

    $sign->setText($signt[0], "§b".$signt[1], "§fJoinable""§d0§e / §d".$this->MAX);



    }}

    }}
    Note this is not the whole code of the function



    Code on Interact:

    PHP:

    public function onInteract(PlayerInteractEvent $event){


    if(
    $event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68){

             

    $sign $event->getPlayer()->getLevel()->getTile($event->getBlock());

    $signt $sign->getText();
               
     if(
    $signt[0] == "§d[§9TW§d]"){

    var_dump("interact");

    // remove the color text from the world name
    $signt[1] = str_replace("§b"""$signt[1]);




    if(
    $signt[2] != "§fJoinable"){
    $event->getPlayer()->sendMessage($this->PREFIX."The game is already full.");
    return;
    }


    // check if the level exists
    if($this->getServer()->isLevelGenerated($signt[1])){
    $this->joinGame($event->getPlayer(), str_replace("§b"""$signt[1]));


    // refresh sign text
    $s1 str_replace("§"""$signt[3]);
    $s2 str_replace(" """$s1);
    $s3 str_replace("/"""$s2);
    $s4 str_replace("e"""$s3);
    $s5 str_replace("d"""$s4);
    $am str_replace($this->MAX""$s5);

    $am $am 1;

    if(
    $am != $this->MAX){
    $sign->setText($signt[0], "§b".$signt[1], $signt[2], "§d".$am."§e / §d".$this->MAX);
    }

    if(
    $am == $this->MAX){
    $sign->setText($signt[0], "§b".$signt[1], "§cIngame""§d".$am."§e / §d".$this->MAX);

    }


    }else{
    $event->getPlayer()->sendMessage($this->PREFIX."This game is not in usage.");
    }


       }        
        }}

       
       
  4. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    You can also show me codes of a sign system, because I think my code isnt the best anymore...
  5. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    if($event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68){
    323 :)
    MyNameIsTriXz likes this.
  6. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    AndrewBit and MyNameIsTriXz like this.
  7. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
  8. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Using a foreach inside a task the most of times is not a good decission. x)
  9. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    How did you do it then?
  10. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    I have this same bug. When a player leaves the game, when they rejoin, the server still thinks they are in the world they were in when they left for some reason. Any luck on fixing this so far?
  11. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    I used that kind of way that xBeastMode uses, getTiles() and then get the player amount of their level. I could only keep the player event dependet sign updating on PlayerInteractEvent, I had to remove it on PlayerQuitEvent, now I use as I said the getTiles() method

Share This Page

Advertisement