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

How to fix it?

Comments in 'Plugin Development' started by Ellein1, Oct 14, 2016.

  1. Ellein1
    Offline

    Ellein1 New Member

    Joined:
    Oct 8, 2016
    Posts:
    1
    Minecraft User:
    Ellein
    How to fix it to the pickaxes destroyed?

    <?php

    namespace stonegen;

    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\LavaParticle;
    use pocketmine\level\sound\BlazeShootSound;


    class Main extends PluginBase implements Listener{


    public function onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
    $this->saveDefaultConfig();
    $this->getServer()->getLogger()->info(TextFormat::GREEN . "Loading");
    }

    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 Stone());
    $gracz->sendMessage("• Postawiles stoniarke! •");
    $center = new Vector3($x, $y, $z);
    $particle = new LavaParticle($center);
    for($yaw = 0, $y = $center->y; $y < $center->y + 3; $yaw += (M_PI * 2) / 20, $y += 1 / 20) {
    $x = -sin($yaw) + $center->x;
    $z = cos($yaw) + $center->z;
    $particle->setComponents($x, $y, $z);
    }
    }else{
    $gracz->sendMessage("• Nie możesz postawić tutaj stoniarki, ten teren jest zabezpieczony •");
    }
    }
    }

    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(TextFormat::YELLOW . "• Stoniarka usunięta •");
    $center = new Vector3($x, $y, $z);
    $particle = new LavaParticle($center);
    for($yaw = 0, $y = $center->y; $y < $center->y + 5; $yaw += (M_PI * 4) / 20, $y += 3 / 20) {
    $x = -sin($yaw) + $center->x;
    $z = cos($yaw) + $center->z;
    $particle->setComponents($x, $y, $z);
    }
    }
    }
    }
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
  3. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
  4. EdwardAllington
    Offline

    EdwardAllington Active Member

    Joined:
    Jan 29, 2015
    Posts:
    78
    Minecraft User:
    Edwardthedog2
    What do you mean?
  5. corytortoise
    Offline

    corytortoise New Member

    Joined:
    Aug 23, 2015
    Posts:
    10
    Minecraft User:
    corytortoise
    Please use the code insertion tool to make it easier on everyone. Do you want the entire pickaxe broken, or do you just want a certain amount of damage done to it?
    EdwardAllington likes this.

Share This Page

Advertisement