1 minute estimated read time

Interactable items

Below is an example of an item that your players can interact with.
The item will have a cooldown of 1 second.

MyItem.java
@VitalItem.Info(type = Material.STICK, name = "My item", cooldown = 1_000)
public class MyItem extends VitalItem {
    @Override
    public void onRightClick(PlayerInteractEvent e) {
        e.getPlayer().sendMessage("You have right-clicked the item!");
    }

    @Override
    public void onLeftClick(PlayerInteractEvent e) {
        e.getPlayer().sendMessage("You have left-clicked the item!");
    }

    @Override
    public void onCooldown(PlayerInteractEvent e) {
        e.getPlayer().sendMessage("The item is still on cooldown!");
    }
}

Found an issue?

Help us improve the documentation by reporting typos, missing information, or anything confusing.

Don't worry, we will auto-fill most of the annoying fields.

Create GitHub issue

This site and the Vital framework were built with ❤️ by Mike Neumann