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

Plzz editi my code

Comments in 'Plugin Development' started by PolskiTHEPLAYER, May 27, 2016.

  1. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    PHP:
    <?php

    namespace Flsmers;

    use 
    pocketmine\plugin\PluginBase as PluginBase;
    use 
    pocketmine\event\Listener as Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\event\block\BlockBreakEvent;
    use 
    pocketmine\event\block\BlockPlaceEvent;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\block\Block;
    use 
    pocketmine\block\Air;
    use 
    pocketmine\block\Stone;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\level\particle\ExplodeParticle;


    class 
    Main extends PluginBase implements Listener{


        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this,$this);  
            
    $this->saveDefaultConfig();
            
    $this->getServer()->getLogger()->info(TextFormat::GREEN "[StoneGenerator] Włączony");
        }
      
        public function 
    onPlace(BlockPlaceEvent $event){
        
    $blok $event->getBlock();
        
    $gracz $event->getPlayer();
        
    $y $blok->getFloorY();
        
    $x $blok->getFloorX();
        
    $z $blok->getFloorZ();
        
          if(
    $blok->getId() == 121){
           if(!(
    $event->isCancelled())){
          
    $gracz->getLevel()->setBlock(new Vector3($blok->getFloorX(), $blok->getFloorY()-1$blok->getFloorZ()), new Obsidian());
         
    $gracz->sendMessage("§a • Postawiłeś - StoneGenerator • ");
            
    $center = new Vector3($x$y$z);
            
    $particle = new ExplodeParticle($center);
            for(
    $yaw 0$y $center->y$y $center->3$yaw += (M_PI 2) / 20$y += 20) {
                
    $x = -sin($yaw) + $center->x;
                
    $z cos($yaw) + $center->z;
                
    $particle->setComponents($x$y$z);
                 
    $gracz->getLevel()->addParticle($particle);
        }
         }else{
          
    $gracz->sendMessage("§c • Nie możesz postawić tutaj - StoneGenerator • ");
         }    
        }
    }
        
        public function 
    onBreak(BlockBreakEvent $event){
         
    $blok $event->getBlock();
         
    $gracz $event->getPlayer();
         
    $y $blok->getFloorY();
         
    $x $blok->getFloorX();
          
    $z $blok->getFloorZ();
           if(
    $blok->getId() == 1){
            if(
    $gracz->getLevel()->getBlock(new Vector3($x$y-1$z))->getId() == 121) {
             
    $event->setCancelled();
              if(
    $this->getConfig()->get("rzeczy-do-eq") == "tak"){
                
    $gracz->getInventory()->addItem(Item::get($this->getConfig()->get("item"), 0$this->getConfig()->get("ilosc")));
               }elseif(
    $this->getConfig()->get("rzeczy-do-eq") == "nie"){
                
    $gracz->getLevel()->dropItem(new Vector3($x$y$z), Item::get($this->getConfig()->get("item"), 0$this->getConfig()->get("ilosc")));
               }
            }
                }elseif(
    $blok->getId() == 121){
                  
    $gracz->getLevel()->setBlock(new Vector3($blok->getFloorX(), $blok->getFloorY()+1$blok->getFloorZ()), new Air());
         
    $gracz->sendMessage("§a • Usunąłeś - StoneGenerator • ");
         
    $center = new Vector3($x$y$z);
            
    $particle = new ExplodeParticle($center);
            for(
    $yaw 0$y $center->y$y $center->3$yaw += (M_PI 2) / 20$y += 20) {
                
    $x = -sin($yaw) + $center->x;
                
    $z cos($yaw) + $center->z;
                
    $particle->setComponents($x$y$z);
                 
    $gracz->getLevel()->addParticle($particle);
        }
         }
            }
        }
    Please edit my code to spawn obsidian to bedrock

    Sorry my english is not good[/PhP]
  2. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Your question doesn't make sense; Specify where.
    IcePL likes this.
  3. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Neither does the code. But I am gonna make a suggestion. FIX THE TYPOS!!! ITS ANNOYING ME!! (Not you Minebuilder... but in that code is TYPOS! ARGHHHH IT BURNS MY SOUL!
    MichaelM04, minebuilder0110 and IcePL like this.
  4. IcePL
    Offline

    IcePL New Member

    Joined:
    Feb 16, 2016
    Posts:
    73
    Minecraft User:
    IcePL
    before writing plugins recommend science pocketmine api and php ...


    and review more closely His problem ... Your every post ends with ' pls edit this code for me'
    TheDeibo likes this.

Share This Page

Advertisement