Closed tbhDequan closed 6 years ago
Please provide example code to demonstrate what you're doing. Code > words.
Also, you can edit your issue, so no need to create a new one next time.
Done
public function onPlayerJoin(PlayerJoinEvent $event){
$p = $event->getPlayer();
$item = ItemFactory::get(Item::DIAMOND_AXE);
if($item instanceof Durable){
$item->setUnbreakable();
var_dump($item->isUnbreakable());
}
$p->getInventory()->setItemInHand($item);
$p->getInventory()->sendHeldItem($p);
}
works for me.
Closing due to not reproducible. Please seek code assistance on the forums; do not use this issue tracker for support requests.
Ok thanks
What I expected : For the item to be unbreakable What happened : Item still breaks
PocketMine-MP: PocketMine-MP version 1.7dev-698 "[REDACTED]" (API 3.0.0-ALPHA11)
PHP: 7.2
Game version: PE
Tested on a clean server with only the plugin and it still didn't work If the issue is not reproducible without plugins:
Code:
item = Item::get(Item::DIAMOND_PICKAXE);
if($item instanceof Durable){ $item->setUnbreakable(); }