1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Second Config recieve/set

Discussion in 'Development' started by MrDevCat, Feb 1, 2019.

  1. MrDevCat

    MrDevCat Spider Jockey

    Messages:
    28
    GitHub:
    elementalminecraftgaming
    Hello,

    I am having a little trouble with the setting and receiving from my second config.
    I also want to switch the get and set config code I have for the psetwarp and pwarp to normal getConfig code that doesn't add quotes but can't figure out how to get and set the second config with getConfig and only can manage with:
    PHP:
    $configp $this->paywarps;
    $configp->set($warp, [$PRICE$a$x$y$z]);

    PHP:
                                $warp $args[0];
                                
    $config $this->paywarps;
                                
    $data $config->get($args[0]);
                                if (
    is_array($data)) {
                                    
    $PRICE $data[0];
                                    
    $land $data[1];
                                    
    $x $data[2];
                                    
    $y $data[3];
                                    
    $z $data[4];
                                }
                                
    EconomyAPI::getInstance()->takeMoney($sender->getName(), (int) $PRICE);
                                
    $sender->sendMessage(TextFormat::GOLD "Warping $warp at $land$x$y$z this warp was not free it cost you $PRICE!");
                                
    $sender->teleport(new Position($x$y$z$this->getServer()->getLevelByName($land))); //
    PHP:
                                $sender->sendMessage(TextFormat::GOLD "Setting warp");
                                
    $PRICE $args[1];
                                
    $a $sender->getLevel()->getFolderName();
                                
    $z $sender->getZ();
                                
    $x $sender->getX();
                                
    $y $sender->getY();
                                
    $warp $args[0];
                                
    $configp $this->paywarps;
                                
    $configp->set($warp, [$PRICE$a$x$y$z]);
                                
    $configp->save();
                                
    $sender->sendMessage(TextFormat::GOLD "Warp $warp set at: $a$x$y$z with a price of $PRICE");
    Can someone please help.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.