mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Player: allow provision of a custom cooldown duration for items
this would be more useful to plugins, so that it's not necessary to extend any item classes for this trivial purpose.
This commit is contained in:
parent
a2543ff80d
commit
51908ec45a
@ -902,8 +902,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
/**
|
||||
* Resets the player's cooldown time for the given item back to the maximum.
|
||||
*/
|
||||
public function resetItemCooldown(Item $item) : void{
|
||||
$ticks = $item->getCooldownTicks();
|
||||
public function resetItemCooldown(Item $item, ?int $ticks = null) : void{
|
||||
$ticks = $ticks ?? $item->getCooldownTicks();
|
||||
if($ticks > 0){
|
||||
$this->usedItemsCooldown[$item->getId()] = $this->server->getTick() + $ticks;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user