Class SimpleJavaRegistry<T>
java.lang.Object
org.geysermc.geyser.registry.java.SimpleJavaRegistry<T>
- All Implemented Interfaces:
Iterable<T>,JavaRegistry<T>,JavaRegistryLookup<T>,MutableJavaRegistry<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears this registry.voidforEachEntry(Consumer<RegistryEntryData<T>> action) Iteratesactionfor eachRegistryEntryDataof this registry.voidfreeze(IntFunction<T> binder) Freezes this registry.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.iterator()Collection<net.kyori.adventure.key.Key> keys()Returns a collection of all keys in this registry.voidregister(RegistryEntryData<T> entry) Adds a new entry to this registry.intsize()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.geysermc.geyser.registry.java.JavaRegistry
isEmpty, parallelStream, spliterator, streamMethods inherited from interface org.geysermc.geyser.registry.java.JavaRegistryLookup
get, get, getId, getId, getIdOrThrow, getIdOrThrow, getKey, getKey, getKeyOrThrow, getKeyOrThrow, getOrThrow, getOrThrow
-
Constructor Details
-
SimpleJavaRegistry
-
-
Method Details
-
getById
Description copied from interface:JavaRegistryLookupGets theRegistryEntryDatafor the givennetworkIdin this registry, or returns an empty optional if it didn't exist.- Specified by:
getByIdin interfaceJavaRegistryLookup<T>- 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
Description copied from interface:JavaRegistryLookupGets theRegistryEntryDatafor the givenkeyin this registry, or returns an empty optional if it didn't exist.- Specified by:
getByKeyin interfaceJavaRegistryLookup<T>- Parameters:
key- the key to look up- Returns:
- the
RegistryEntryDatacorrelating to the key, or an empty optional if it didn't exist
-
getByValue
Description copied from interface:JavaRegistryLookupGets theRegistryEntryDatafor the givenobjectin this registry, or returns an empty optional if it didn't exist.- Specified by:
getByValuein interfaceJavaRegistryLookup<T>- Parameters:
object- the object to look up- Returns:
- the
RegistryEntryDatacorrelating to the object, or an empty optional if it didn't exist
-
keys
Description copied from interface:JavaRegistryReturns a collection of all keys in this registry.Note that this collection may not necessarily be sorted by network ID.
- Specified by:
keysin interfaceJavaRegistry<T>- Returns:
- a collection of all keys in this registry
-
size
public int size()- Specified by:
sizein interfaceJavaRegistry<T>- Returns:
- the amount of entries in this registry
-
register
Description copied from interface:MutableJavaRegistryAdds a new entry to this registry.- Specified by:
registerin interfaceMutableJavaRegistry<T>- Parameters:
entry- the entry to add
-
clear
public void clear()Description copied from interface:MutableJavaRegistryClears this registry. All entries will be wiped, and the registry will be mutable again, if it was frozen.- Specified by:
clearin interfaceMutableJavaRegistry<T>
-
freeze
Description copied from interface:MutableJavaRegistryFreezes this registry. This method uses the givenIntFunctionto bind all unbound registry entries. As a result, after calling this method, all registry entries should be bound.The
IntFunctionis given a network ID, and it is expected to return aMutableJavaRegistryfor that respective network ID. If it returnsnull, aNullPointerExceptionis thrown.- Specified by:
freezein interfaceMutableJavaRegistry<T>- Parameters:
binder- the function used to bind unbound registry entries- See Also:
-
forEachEntry
Description copied from interface:JavaRegistryIteratesactionfor eachRegistryEntryDataof this registry.The action is executed in order of network ID.
- Specified by:
forEachEntryin interfaceJavaRegistry<T>- Parameters:
action- the action to execute for eachRegistryEntryData
-
iterator
-
toString
-