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

How to set drops when player break the block stone.

Comments in 'Plugin Development' started by IcePL, Feb 16, 2016.

  1. IcePL
    Offline

    IcePL New Member

    Joined:
    Feb 16, 2016
    Posts:
    73
    Minecraft User:
    IcePL
    Hi how to set drops when player break the block?I need for create Drop from stone plugin.
  2. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    public function onBreakk(BlockBreakEvent $var){$blockid 1;$itemdrops 1;
    if(
    $var->getBlock()->getID() == $blockid){
    $var->setDrops(array(Item::get($itemdrops)));
    }
    }
    Omar2s2 likes this.
  3. IcePL
    Offline

    IcePL New Member

    Joined:
    Feb 16, 2016
    Posts:
    73
    Minecraft User:
    IcePL
    And how to set nodrop ores?
  4. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    Can you learn php /or/&/ pm-mp api ?
  5. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
  6. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

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

    namespace Drop/dr;

    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\untils\TextFormat;
    use pocketmine\untils\MainLogger;
    use pocketmine\block\Block;
    use pocketmine\item\Item;

    class Main extends PluginBase implaments Listener{

    public function onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
    $this->saveDefaultConfig();
    $this->getServer()->getLogger()->info(TextFormat::GREEN."[Plugin] Online");
    }
    public function onBreak(BlockBreakEvent $var){$blockid = 1;$itemdrops = 1;
    if($var->getBlock()->getID() == $blockid){$var->setDrops(array(Item::get($itemdrops)));
    }
    }
  7. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    What is "untils"??
    Use [php]#code[/php] to share php code..
  8. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    Sorry utils
  9. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    1. you just wrote what @Nawaf_Craft1b said.
    2. nothing to do with PHP.
    3. you learn PHP and stop spamming :)
    Last edited: Feb 17, 2016
  10. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Why you said "You learn PHP" if you don't know it?
    Stop trying to be a "hacker", because you are only a newbie inside this community. I'm not a professional too, but I'm enoughly appropriate to tell you that you are a newbie (noob?) here, you can't try to help if you don't know how to do it...

    And, please, you literally copied @Nawaf_Craft1b code. -.-
  11. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    When exactly did he say to learn everything about PHP? I can just learn some simple grammar and say I have learnt PHP.
  12. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Why need saveDefaultConfig()? You simply just copy and paste the code without even understand what are you doin'
    PocketKiller, KubixQ and PEMapModder like this.
  13. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I love how the people try to be contrary to another people only for get some likes. :p
    Nawaf_Craft1b likes this.
  14. KubixQ
    Offline

    KubixQ Active Member

    Joined:
    Sep 13, 2015
    Posts:
    85
    Minecraft User:
    KubixQ
    Who?
    Marttinek likes this.
  15. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I think that he's speaking with himself, or trying to call people attention...
    KubixQ likes this.
  16. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Unfortunately, this is not the case here.

Share This Page

Advertisement