Hi, i want to set another drops when player break a stone block Here's the code ; function onBreak(BlockBreakEvent $ev){ switch($ev->getBlock()->getId()){ case 1: $ev->setDrops(array(Item::get(276,0,1)->setCustomName("TEST"))); break; } } But, Its not working, it drop cobblestone i've seen this post https://forums.pmmp.io/threads/blockbreakevent-does-not-work-wtf.898/page-2 and addet implement Listener but still not working
It needs to be PHP: $level = $event->getBlock()->getLevel();$level->setDrops (new Vector3 ($block->getX(), $block->getY(), $block->getZ()), array(Item::get(276,0,1)->setCustomName("TEST")));
PHP: if ($event->getPlayer()->getInventory()->getItemInHand()->getId() === array(Item::DIAMOND_PICKAXE, Item::IRON_PICKAXE, Item::GOLD_PICKAXE, Item::STONE_PICKAXE, Item::WOODEN_PICKAXE)) { // Your Code} else { return;}
No, an integer will never be equal to an array, which means this will never work. Use in_array if you are using an array.