mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Item: Moved getMaxDurability() to Durable class only, and make it abstract
It's only now used in the Durable class, so it does not make sense to keep it in Item anymore. This is a leftover from the days where Durable did not exist.
This commit is contained in:
parent
d728154e87
commit
efca9f0450
@ -39,7 +39,7 @@ class Bow extends Tool{
|
||||
return 200;
|
||||
}
|
||||
|
||||
public function getMaxDurability(){
|
||||
public function getMaxDurability() : int{
|
||||
return 385;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -49,7 +49,7 @@ class FlintSteel extends Tool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMaxDurability(){
|
||||
public function getMaxDurability() : int{
|
||||
return 65;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class Shears extends Tool{
|
||||
parent::__construct(self::SHEARS, $meta, "Shears");
|
||||
}
|
||||
|
||||
public function getMaxDurability(){
|
||||
public function getMaxDurability() : int{
|
||||
return 239;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ abstract class TieredTool extends Tool{
|
||||
$this->tier = $tier;
|
||||
}
|
||||
|
||||
public function getMaxDurability(){
|
||||
public function getMaxDurability() : int{
|
||||
return self::getDurabilityFromTier($this->tier);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user