Package io.papermc.paper.registry

# Interface Reference<T extends Keyed>

Type Parameters:
  `T` - type of the value

All Superinterfaces:
  `net.kyori.adventure.key.Keyed`, `Keyed`

public interface Reference<T extends Keyed> extends Keyed
Represents a reference to a server-backed registry value that may change.

## Method Summary

Modifier and Type
Method
Description
`static <T extends Keyed>
@NotNull Reference<T>`
`create(@NotNull Registry<T> registry, @NotNull NamespacedKey key)`
Creates a reference to a registered value.
`T`
`value()`
Gets the value from the registry with the key.
`T`
`valueOrNull()`
Gets the value from the registry with the key.

### Methods inherited from interface org.bukkit.Keyed

`getKey, key`

## Method Details

### value

@NotNull T value()
Gets the value from the registry with the key.

Returns:
  the value
Throws:
  `NoSuchElementException` - if there is no value with this key

### valueOrNull

@Nullable T valueOrNull()
Gets the value from the registry with the key.

Returns:
  the value or null if it doesn't exist

### create

@NotNull static <T extends Keyed> @NotNull Reference<T> create(@NotNull @NotNull Registry<T> registry, @NotNull @NotNull NamespacedKey key)
Creates a reference to a registered value.

Type Parameters:
  `T` - the type of the value
Parameters:
  `registry` - the registry the value is located in
  `key` - the key to the value
Returns:
  a reference