Context

The page describes the context concept implemented in the library.

What is a context?

In the library, a Context is a class that store values identified by keys which may differ depending on where the context is created and used. It is used in value providers and placeholders.

Common values

By default, several values may be added by the library and present in a context. The CommonContextKeyEnum is an enumeration that defines the keys of these common values.

These keys are described in the following table:

Key
Type
Type of context
Description

VIEWER

Player

Everywhere

The player who is viewing the inventory

INVENTORY

FastInventory

Everywhere

The inventory viewed

SLOT

Integer

Item

The slot of the item

PAGINATION_ID

String

Pagination

The id of the pagination

PAGINATION_ITEM

Depends on what is paginated

Pagination item

The current pagination item

Some keys are not available depending on where the context is declared and used. You must always check that the key is present before retrieving its associated value.

Last updated