Skip to content

Chargeable 5.46.0 ​

interface · pocketmine\item\Chargeable · source

Extends Releasable

Interface implemented by objects that can be charged.

Flow (same as vanilla): the first use starts charging; while charging, the client sends another use when its own charge bar is full, which calls onChargeComplete(); releasing before that cancels; once charged, the next use fires (onClickAir()).

Methods ​

getChargeDuration() ​

php
public function getChargeDuration() : int

Returns an amount of ticks that this item should be in charge.

isCharged() ​

php
public function isCharged() : bool

onChargeComplete() ​

php
public function onChargeComplete(\pocketmine\player\Player $player, int $useDuration) : bool

Called when the client reports that charging finished. Returns whether the item is now charged.

setCharged() ​

php
public function setCharged(?\pocketmine\item\Item $item) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.