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

Help

Comments in 'Plugin Development' started by TryoneLegendZzz, Aug 13, 2015.

  1. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    EDIT: how can i add how many blocks a player breaks too a file?
    Last edited: Aug 13, 2015
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function onBreak(BlockBreakEvent $e){
            
    $p $e->getPlayer();
            
    $b $e->getBlock();
            
    $file $your_file//your file
            
    $cont file_get_contents($file);
            if(
    substr($cont, -1) == "|"){
                
    file_put_contents($file$cont."$b->x:$b->y:$b->z:$b->id:$b->damage:{$b->level->getName()}");
                return;
            }
            
    file_put_contents($file$cont."|$b->x:$b->y:$b->z:$b->id:$b->damage:{$b->level->getName()}");
        }
    format will be:
    Code:
    45:66:485:2:0:world|96:46:455:90:0:world
    TryoneLegendZzz likes this.
  3. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    ok is there anyway i can put this through a string and make it come out as id:amount?
  4. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    nvm forget i said this
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    yes use explode()
  6. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    already done this but how do i get it to go to my config.yml?
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    File is config.yml

Share This Page

Advertisement