diff --git a/src/pocketmine/item/Bow.php b/src/pocketmine/item/Bow.php index 4ca73b053..05ff62828 100644 --- a/src/pocketmine/item/Bow.php +++ b/src/pocketmine/item/Bow.php @@ -39,7 +39,7 @@ class Bow extends Tool{ return 200; } - public function getMaxDurability(){ + public function getMaxDurability() : int{ return 385; } diff --git a/src/pocketmine/item/Durable.php b/src/pocketmine/item/Durable.php index d2960f836..f5f67b7e4 100644 --- a/src/pocketmine/item/Durable.php +++ b/src/pocketmine/item/Durable.php @@ -82,6 +82,14 @@ abstract class Durable extends Item{ return 0; } + + /** + * Returns the maximum amount of damage this item can take before it breaks. + * + * @return int + */ + abstract public function getMaxDurability() : int; + /** * Returns whether the item is broken. * @return bool diff --git a/src/pocketmine/item/FlintSteel.php b/src/pocketmine/item/FlintSteel.php index fcce0bf08..4196de9c5 100644 --- a/src/pocketmine/item/FlintSteel.php +++ b/src/pocketmine/item/FlintSteel.php @@ -49,7 +49,7 @@ class FlintSteel extends Tool{ return false; } - public function getMaxDurability(){ + public function getMaxDurability() : int{ return 65; } } diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index a39fe2b9a..cd4016714 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -761,15 +761,6 @@ class Item implements ItemIds, \JsonSerializable{ return 0; } - /** - * Returns the maximum amount of damage this item can take before it breaks. - * - * @return int|bool - */ - public function getMaxDurability(){ - return false; - } - public function isPickaxe(){ return false; } diff --git a/src/pocketmine/item/Shears.php b/src/pocketmine/item/Shears.php index 44129b0d5..3a32b3ab8 100644 --- a/src/pocketmine/item/Shears.php +++ b/src/pocketmine/item/Shears.php @@ -30,7 +30,7 @@ class Shears extends Tool{ parent::__construct(self::SHEARS, $meta, "Shears"); } - public function getMaxDurability(){ + public function getMaxDurability() : int{ return 239; } diff --git a/src/pocketmine/item/TieredTool.php b/src/pocketmine/item/TieredTool.php index 4ec1841cd..7fa289889 100644 --- a/src/pocketmine/item/TieredTool.php +++ b/src/pocketmine/item/TieredTool.php @@ -38,7 +38,7 @@ abstract class TieredTool extends Tool{ $this->tier = $tier; } - public function getMaxDurability(){ + public function getMaxDurability() : int{ return self::getDurabilityFromTier($this->tier); }