mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Added Durable class, fixed some tools not breaking correctly, removed some boilerplate code
This commit is contained in:
@ -2512,12 +2512,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
if($this->isSurvival()){
|
||||
if($heldItem->isTool()){
|
||||
if($heldItem->useOn($target) and $heldItem->getDamage() >= $heldItem->getMaxDurability()){
|
||||
$this->inventory->setItemInHand(ItemFactory::get(Item::AIR, 0, 0));
|
||||
}else{
|
||||
$this->inventory->setItemInHand($heldItem);
|
||||
}
|
||||
if($heldItem->useOn($target)){
|
||||
$this->inventory->setItemInHand($heldItem);
|
||||
}
|
||||
|
||||
$this->exhaust(0.3, PlayerExhaustEvent::CAUSE_ATTACK);
|
||||
|
Reference in New Issue
Block a user