PHPackages                             j1b1x/functionalitem - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. j1b1x/functionalitem

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

j1b1x/functionalitem
====================

31271[1 PRs](https://github.com/J1b1x/FunctionalItem/pulls)PHP

Since Apr 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/J1b1x/FunctionalItem)[ Packagist](https://packagist.org/packages/j1b1x/functionalitem)[ RSS](/packages/j1b1x-functionalitem/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (1)Used By (0)

FunctionalItem
==============

[](#functionalitem)

[![php](https://camo.githubusercontent.com/6e2ca56a2d75d2d6d8bdbcea333f3f9bf4576c0229affc2b32fbc3ce47fe62f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312d696e666f726d6174696f6e616c)](https://camo.githubusercontent.com/6e2ca56a2d75d2d6d8bdbcea333f3f9bf4576c0229affc2b32fbc3ce47fe62f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312d696e666f726d6174696f6e616c)[![api](https://camo.githubusercontent.com/09f5789e63311cafb26c8af7e2f3f9f5fd29d49b678e18edad26402ee7abb73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706f636b65746d696e652d352e302d696e666f726d6174696f6e616c)](https://camo.githubusercontent.com/09f5789e63311cafb26c8af7e2f3f9f5fd29d49b678e18edad26402ee7abb73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706f636b65746d696e652d352e302d696e666f726d6174696f6e616c)

FunctionalItem is a PocketMine-MP library to give items functionalities using actual classes instead of Events.

Categories
----------

[](#categories)

- [Library registration](#library-registration)
- [Item registration](#item-registration)
- [Functional Item](#functional-item)
    - [Item Flags](#item-flags)
        - [Flags](#flags)
        - [Apply a flag](#apply-a-flag-to-a-functionalitem)
    - [Item functions](#item-functions)
    - [Example Item](#how-to-make-a-functionalitem)
    - [Give a Functional item](#how-to-give-a-functionalitem)

Library registration
--------------------

[](#library-registration)

### Just do this in the onEnable function of your plugin

[](#just-do-this-in-the-onenable-function-of-your-plugin)

```
\Jibix\FuctionalItem\FunctionalItemManager::register($this);
```

Item registration
-----------------

[](#item-registration)

### In order to make a functional item actually work, you first need to register it, just like this

[](#in-order-to-make-a-functional-item-actually-work-you-first-need-to-register-it-just-like-this)

```
\Jibix\FuctionalItem\FunctionalItemManager::getInstance()->registerFunctionalItem(new MyFunctionalItem());
```

Functional Item
---------------

[](#functional-item)

### Item Flags

[](#item-flags)

#### Flags

[](#flags)

- NonPlaceableFlag

#### Apply a flag to a FunctionalItem

[](#apply-a-flag-to-a-functionalitem)

```
//Basically do implements YourFlag
class ExampleItem extends \Jibix\FuctionalItem\item\FunctionalItem implements ItemFlag{
```

### Item Functions

[](#item-functions)

```
    //Checks if $item equals the functional item
    //Example: ExampleItem::equals($player->getInventory()->getItemInHand())
    public static function equals(Item $item): bool;

    //Removes the functional item from the player's inventory
    public static function remove(Inventory $inventory): void;

    //Returns the cooldown time (in ticks) until the item can be used again
    public function getCooldownTicks(Player $player, Item $item): int;

    //Called when the player right-clicks this item
    //If it returns false, the interaction will be canceled
    public function onUse(Player $player, ?Vector3 $useVector = null): bool;

    //Called when the player drops this item
    //If it returns false, the drop will be canceled
    public function onDrop(Player $player): bool;

    //Called when the player helds this item
    //If it returns false, the slot switch will be canceled
    public function onHeld(Player $player, int $slot): bool;

    //Called when the player clicks this item in their inventory
    //If it returns false, the inventory transaction will be canceled
    public function onInvClick(Player $player): bool;

    //Called when the player hits an entity with this item
    //If it returns false, the damage event will be canceled
    public function onHitEntity(Player $player, Entity $entity): bool;

    //Called when the player right-clicks an entity with this item
    //If it returns false, the interaction will be canceled
    public function onInteractEntity(Player $player, Entity $entity, Vector3 $clickPos): bool;
```

### How to make a FunctionalItem

[](#how-to-make-a-functionalitem)

```
class ExampleItem extends \Jibix\FuctionalItem\item\FunctionalItem{

    private const USE_COOLDOWN = 5 * 20; //5 seconds

    public static function getItem(?Player $player = null, string $customName = "§bExample"): Item{
        return self::getInternalItem(VanillaItems::STICK()->setCustomName($customName));
    }

    public function getCooldownTicks(Player $player, Item $item): int{
        return self::USE_COOLDOWN;
    }

    public function onDrop(Player $player): bool{
        return false; //Can't be dropped
    }

    public function onUse(Player $player, ?Vector3 $useVector = null): bool{
        $player->sendMessage("You just used the FunctionalItem example-stick!");
        return true;
    }
}
```

### How to give a FunctionalItem

[](#how-to-give-a-functionalitem)

```
$player->getInventory()->addItem(MyFunctionalItem::getItem($player, ...$customArgs));
```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64813399?v=4)[Jibix](/maintainers/J1b1x)[@J1b1x](https://github.com/J1b1x)

![](https://www.gravatar.com/avatar/c1073badf7242d47c040f90cdd3577a6ae9ddb657ebb5675571793ef5df998ff?d=identicon)[xxAROX](/maintainers/xxAROX)

---

Top Contributors

[![J1b1x](https://avatars.githubusercontent.com/u/64813399?v=4)](https://github.com/J1b1x "J1b1x (14 commits)")[![NeturCrafter](https://avatars.githubusercontent.com/u/96377600?v=4)](https://github.com/NeturCrafter "NeturCrafter (1 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")

### Embed Badge

![Health badge](/badges/j1b1x-functionalitem/health.svg)

```
[![Health](https://phpackages.com/badges/j1b1x-functionalitem/health.svg)](https://phpackages.com/packages/j1b1x-functionalitem)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
