Player: added a server-side forced cooldown mechanism

This is necessary because the stupid client constantly spams right-click actions if you carry on trying to eat/throw/whatever the item when cooldown is in effect. Therefore ender pearls would be fired like machine guns without these checks server side.
This commit is contained in:
Dylan K. Taylor
2018-03-09 14:45:01 +00:00
parent 3827892e48
commit 2f266a5922
3 changed files with 67 additions and 2 deletions

View File

@ -821,6 +821,15 @@ class Item implements ItemIds, \JsonSerializable{
return false;
}
/**
* Returns the number of ticks a player must wait before activating this item again.
*
* @return int
*/
public function getCooldownTicks() : int{
return 0;
}
/**
* Compares an Item to this Item and check if they match.
*