NumericPlayerSettingButton

data class NumericPlayerSettingButton<N : Number>(val key: NamespacedKey, val min: N, val max: N, val step: N, val shiftStep: N, val type: (Number) -> N, val getter: (Player) -> N, val setter: (Player, N) -> Unit, val decorator: (Player, N) -> ItemStack, val placeholderProvider: (Player, N) -> MutableList<ComponentLike> = { _, setting -> mutableListOf<ComponentLike>( PylonArgument.of("value", Component.text(setting.toString())) ) }) : AbstractItem(source)

A button for changing a numeric setting for a player. (e.g. volume, brightness, etc.)

key The namespaced key for this setting. Used for translation keys and persistent data.

min The minimum value for the setting.

max The maximum value for the setting.

step The amount to increase or decrease the setting by on a normal click.

shiftStep The amount to increase or decrease the setting by on a shift click.

type Converts a Number to the specific setting type N. (e.g. Number.toInt, Number.toDouble, etc.)

getter Gets the current setting value for a player.

setter Sets the current setting value for a player.

decorator Determines what the base ItemStack of the button looks like for a player their current setting value.

  • This is useful for adding visual indicators of the current setting value, such as changing the material or custom model data.

  • The name and lore of the button will be applied on top of this ItemStack.

placeholderProvider Provides additional placeholders for the translation. (See TranslatableComponent.arguments and PylonArgument)

  • By default there is a placeholder "value" which contains the current setting value.

Constructors

Link copied to clipboard
constructor(key: NamespacedKey, min: N, max: N, step: N, shiftStep: N, type: (Number) -> N, getter: (Player) -> N, setter: (Player, N) -> Unit, decorator: (Player, N) -> ItemStack, placeholderProvider: (Player, N) -> MutableList<ComponentLike> = { _, setting -> mutableListOf<ComponentLike>( PylonArgument.of("value", Component.text(setting.toString())) ) })

Properties

Link copied to clipboard
Link copied to clipboard
val getter: (Player) -> N
Link copied to clipboard
Link copied to clipboard
val max: N
Link copied to clipboard
val min: N
Link copied to clipboard
val setter: (Player, N) -> Unit
Link copied to clipboard
Link copied to clipboard
val step: N
Link copied to clipboard
val type: (Number) -> N

Functions

Link copied to clipboard
open override fun addWindow(p0: AbstractWindow)
Link copied to clipboard
open override fun getItemProvider(player: Player): ItemProvider?
Link copied to clipboard
open override fun getWindows(): MutableSet<Window>
Link copied to clipboard
open override fun handleClick(clickType: ClickType, player: Player, event: InventoryClickEvent)
Link copied to clipboard
open override fun notifyWindows()
Link copied to clipboard
open override fun removeWindow(p0: AbstractWindow)