Interface JavaRegistryLookup<T>
- Type Parameters:
T- the type of the registry
- All Known Subinterfaces:
JavaRegistry<T>,MutableJavaRegistry<T>
- All Known Implementing Classes:
SimpleJavaRegistry
public interface JavaRegistryLookup<T>
Provides basic access to a Java registry as defined in
JavaRegistries. Instances of this interface
should be used to get access to one or multiple entries in the registry. For iterating over the entire registry,
see the extensions provided by JavaRegistry.
Instances of this interface can be obtained through JavaRegistryProvider (usually provided by GeyserSession.javaRegistries()),
or by using the constants in BuiltInJavaRegistries.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionget(int networkId) Gets theJavaRegistryLookupfor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.get(net.kyori.adventure.key.Key key) Gets theJavaRegistryLookupfor the givenkeyin this registry, or returns an empty optional if it didn't exist.getById(int networkId) Gets theRegistryEntryDatafor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.getByKey(net.kyori.adventure.key.Key key) Gets theRegistryEntryDatafor the givenkeyin this registry, or returns an empty optional if it didn't exist.getByValue(T object) Gets theRegistryEntryDatafor the givenobjectin this registry, or returns an empty optional if it didn't exist.default OptionalIntgetId(net.kyori.adventure.key.Key key) Gets the network ID for the givenkeyin this registry, or returns an empty optional if it didn't exist.default OptionalIntGets the network ID for the givenobjectin this registry, or returns an empty optional if it didn't exist.default intgetIdOrThrow(net.kyori.adventure.key.Key key) Gets the network ID for the givenkeyin this registry, or throws if it didn't exist.default intgetIdOrThrow(T object) Gets the network ID for the givenobjectin this registry, or throws if it didn't exist.default Optional<net.kyori.adventure.key.Key> getKey(int networkId) Gets theKeyfor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.default Optional<net.kyori.adventure.key.Key> Gets theKeyfor the givenobjectin this registry, or returns an empty optional if it didn't exist.default net.kyori.adventure.key.KeygetKeyOrThrow(int networkId) Gets theKeyfor the givennetworkIdin this registry, or throws if it didn't exist.default net.kyori.adventure.key.KeygetKeyOrThrow(T object) Gets theKeyfor the givenobjectin this registry, or throws if it didn't exist.default TgetOrThrow(int networkId) Gets theJavaRegistryLookupfor the givennetworkIdin this registry, or throws if it didn't exist.default TgetOrThrow(net.kyori.adventure.key.Key key) Gets theJavaRegistryLookupfor the givenkeyin this registry, or throws if it didn't exist.
-
Method Details
-
getIdOrThrow
Gets the network ID for the givenobjectin this registry, or throws if it didn't exist.- Parameters:
object- the object to look up- Returns:
- the network ID correlating to the object
- Throws:
IllegalStateException- when theobjectwas not present in this registry
-
getId
Gets the network ID for the givenobjectin this registry, or returns an empty optional if it didn't exist.- Parameters:
object- the object to look up- Returns:
- the network ID correlating to the object, or an empty optional if it didn't exist
-
getIdOrThrow
default int getIdOrThrow(net.kyori.adventure.key.Key key) Gets the network ID for the givenkeyin this registry, or throws if it didn't exist.- Parameters:
key- the key to look up- Returns:
- the network ID correlating to the key
- Throws:
IllegalStateException- when thekeywas not present in this registry
-
getId
Gets the network ID for the givenkeyin this registry, or returns an empty optional if it didn't exist.- Parameters:
key- the key to look up- Returns:
- the network ID correlating to the key, or an empty optional if it didn't exist
-
getKeyOrThrow
Gets theKeyfor the givenobjectin this registry, or throws if it didn't exist.- Parameters:
object- the object to look up- Returns:
- the
Keycorrelating to the object - Throws:
IllegalStateException- when theobjectwas not present in this registry
-
getKey
Gets theKeyfor the givenobjectin this registry, or returns an empty optional if it didn't exist.- Parameters:
object- the object to look up- Returns:
- the
Keycorrelating to the object, or an empty optional if it didn't exist
-
getKeyOrThrow
default net.kyori.adventure.key.Key getKeyOrThrow(int networkId) Gets theKeyfor the givennetworkIdin this registry, or throws if it didn't exist.- Parameters:
networkId- the network ID to look up- Returns:
- the
Keycorrelating to the network ID - Throws:
IllegalStateException- when thenetworkIdwas not present in this registry
-
getKey
Gets theKeyfor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.- Parameters:
networkId- the network ID to look up- Returns:
- the
Keycorrelating to the network ID, or an empty optional if it didn't exist
-
getOrThrow
Gets theJavaRegistryLookupfor the givennetworkIdin this registry, or throws if it didn't exist.- Parameters:
networkId- the network ID to look up- Returns:
- the
JavaRegistryLookupcorrelating to the network ID - Throws:
IllegalStateException- when thenetworkIdwas not present in this registry
-
get
Gets theJavaRegistryLookupfor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.- Parameters:
networkId- the network ID to look up- Returns:
- the
JavaRegistryLookupcorrelating to the network ID, or an empty optional if it didn't exist
-
getOrThrow
Gets theJavaRegistryLookupfor the givenkeyin this registry, or throws if it didn't exist.- Parameters:
key- the key to look up- Returns:
- the
JavaRegistryLookupcorrelating to the key - Throws:
IllegalStateException- when thekeywas not present in this registry
-
get
Gets theJavaRegistryLookupfor the givenkeyin this registry, or returns an empty optional if it didn't exist.- Parameters:
key- the key to look up- Returns:
- the
JavaRegistryLookupcorrelating to the key, or an empty optional if it didn't exist
-
getById
Gets theRegistryEntryDatafor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.- Parameters:
networkId- the network ID to look up- Returns:
- the
RegistryEntryDatacorrelating to the network ID, or an empty optional if it didn't exist
-
getByKey
Gets theRegistryEntryDatafor the givenkeyin this registry, or returns an empty optional if it didn't exist.- Parameters:
key- the key to look up- Returns:
- the
RegistryEntryDatacorrelating to the key, or an empty optional if it didn't exist
-
getByValue
Gets theRegistryEntryDatafor the givenobjectin this registry, or returns an empty optional if it didn't exist.- Parameters:
object- the object to look up- Returns:
- the
RegistryEntryDatacorrelating to the object, or an empty optional if it didn't exist
-