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

Save Block Location on Tap

Discussion in 'Development' started by KittyDev, Aug 19, 2017.

  1. KittyDev

    KittyDev Slime

    Messages:
    96
    GitHub:
    FreakingDev
    Hi guys how can i save the location of the blocks to config.yml when i tap it
     
  2. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    PHP:
    public function onTap(PlayerInteractEvent $e){
      
    $p =  $e->getPlayer();
      
    $block $e->getBlock();

      
    //i will use config you can use config or array
      //world
      
    $this->getConfig()->setNested("blocks.".$name.".world"$p->getLevel()->getName());
      
    //X
      
    $this->getConfig()->setNested("blocks.".$name.".x"$block->getX());
      
    //Y
      
    $this->getConfig()->setNested("blocks.".$name.".y"$block->getY());
      
    //Z
      
    $this->getConfig()->setNested("blocks.".$name.".z"$block->getZ());
      
    $this->getConfig()->save();
    }
    hmm...
     
    Last edited: Aug 19, 2017
    xXiKhalediXx and Rysieku like this.
  3. Karanpatel567

    Karanpatel567 Baby Zombie

    Messages:
    115
    GitHub:
    Karanpatel567
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    What is the relevance?
    For saving these data, using an SQL-family database is a much better idea.
     
    Teamblocket, jasonwynn10 and Eduardo like this.
  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.