PotionItem

class PotionItem(name: String, base: PotionType = PotionType.WATER, splash: Boolean = false, lingering: Boolean = false)

Represents a custom potion item with customizable effects, color, and type.

This class allows the creation of potions with different effects, colors, and types (regular, splash, or lingering). The potion can also be customized with various lore, glow effects, and unbreakable properties. The created potion item can be used as a CustomItem and can be registered and given to players.

Parameters

name

The name of the potion item.

base

The base potion type (default is PotionType.WATER).

splash

Whether the potion should be a splash potion (default is false).

lingering

Whether the potion should be a lingering potion (default is false).

Constructors

Link copied to clipboard
constructor(name: String, base: PotionType = PotionType.WATER, splash: Boolean = false, lingering: Boolean = false)

Functions

Link copied to clipboard

Builds and returns the CustomItem representation of the potion item.

Link copied to clipboard
fun color(color: Color): PotionItem
fun color(r: Int, g: Int, b: Int): PotionItem

Sets the color of the potion.

Link copied to clipboard
fun effect(type: PotionEffectType, duration: Int, amplifier: Int, ambient: Boolean = false): PotionItem

Adds a PotionEffect to the potion.

Link copied to clipboard

Adds a glowing effect to the potion item.

Link copied to clipboard
fun lore(vararg lines: String): PotionItem

Adds lore to the potion item.

Link copied to clipboard

Marks the potion item as unbreakable.