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

Need help with plugins

Discussion in 'Help' started by SzanelGirl, Apr 9, 2017.

  1. SzanelGirl

    SzanelGirl Spider Jockey

    Messages:
    28
    GitHub:
    SzanelGirl
    I need help with plugin I Generator Stone please help with how to make the stone end stone and it is still stone as it destroys stone it renews every 3 seconds :

    <?php

    namespace StoneGenerator;

    use pocketmine\plugin\PluginBase as PluginBase;
    use pocketmine\event\Listener as Listener;
    use pocketmine\utils\TextFormat;
    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->saveDefaultConfig();
    $this->getServer()->getLogger()->info(TextFormat::GREEN."[StoneGenerator] Plugin created by SzanelGirl");
    }

    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();
    $gracz->getInventory()->addItem(Item::get(4, 0, 1));
    }else{
    $this->getServer()->getScheduler()->cancelTask($data[2]);
    $this->finishSchedule($block->getX().":".$block->getY().":".$block->getZ().":".$block->getLevel()->getName());
    }
    }
    }
    }
     
  2. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    What exactly do you mean by that part?
     
  3. RoyalMCPE

    RoyalMCPE Slime

    Messages:
    87
    replace

    PHP:
    If($blok->getId()  == 1){
    to

    PHP:
    if ($blok->getId ()  === 121 ) {
     
  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.