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

Task

Discussion in 'Facepalm' started by dragonflex, Mar 11, 2017.

  1. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    Hi! I please edit this code on my plugin
    PHP:
    <?php

    namespace dragonflex;

    use 
    pocketmine\plugin\PluginBase as PluginBase;
    use 
    pocketmine\event\Listener as Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\event\block\BlockBreakEvent;
    use 
    pocketmine\block\Block;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\item\Item;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this,$this);   
            
    $this->getServer()->getLogger()->info(TextFormat::GREEN."[Stoniarka] Plugin stworzony przez dragonflex");
        }
       
        public function 
    onBreak(BlockBreakEvent $event){
         
    $blok $event->getBlock();
         
    $gracz $event->getPlayer();
           
    $y $blok->getFloorY();
           
    $x $blok->getFloorX();
           
    $z $blok->getFloorZ();
       if(
    $this->plugin->time($gracz)) {
          if(
    time() - $this->plugin->getTIMETime($gracz) > 3) {
           if(
    $blok->getId() == 1){
            if(
    $gracz->getLevel()->getBlock(new Vector3($x$y-1$z))->getId() == 121) {
             
    $event->setCancelled();
              
    $gracz->getInventory()->addItem(Item::get(401));
                    }
                }
            }
        }
    }
    }
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Further explanation, please?
     
  3. DaPigGuy

    DaPigGuy Slime

    Messages:
    86
    GitHub:
    DaPigGuy
    1. There's no $this->plugin
    2. There is no getTIMETime
    3. What are you trying to do?
     
  4. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    Add renew stone what 3 seconds
     
  5. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You didn't write that. Give credit when you use somebody else's resource. Link.
     
  6. SzanelGirl

    SzanelGirl Spider Jockey

    Messages:
    28
    GitHub:
    SzanelGirl
    <?php

    namespace stoniarka\stoniarka;

    use pocketmine\scheduler\PluginTask;

    class MyTask extends PluginTask {
    /**
    *
    * @param MyTask $owner
    */
    public function __construct(MyTask $owner) {
    parent::__construct ( $owner );
    }
    public function onRun($currentTick) {
    /**
    * @var $owner MyTask
    */
    $owner = $this->getOwner ();
    $owner->tick ();
    }
    }



    Mian.php
    Add :
    $this->getServer ()->getScheduler ()->scheduleRepeatingTask ( new cstoniarka ( $this ), 20 );
    $this->getServer ()->getPluginManager ()->registerEvents ( $this, $this );
     
  7. SzanelGirl

    SzanelGirl Spider Jockey

    Messages:
    28
    GitHub:
    SzanelGirl
    ZmieƄ se z cstoniarka na MyTask
     
  8. SzanelGirl

    SzanelGirl Spider Jockey

    Messages:
    28
    GitHub:
    SzanelGirl
    Yyy
    }
    }
    }
    }
    }
    }



    ?
    }
    }
    }
     
  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.