java.lang.Object
net.minestom.server.instance.InstanceManager
Used to register
Instance
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates and register anInstanceContainer
.createInstanceContainer
(@Nullable IChunkLoader loader) createInstanceContainer
(RegistryKey<DimensionType> dimensionType) createInstanceContainer
(RegistryKey<DimensionType> dimensionType, @Nullable IChunkLoader loader) Creates and register anInstanceContainer
with the specifiedDimensionType
.createSharedInstance
(InstanceContainer instanceContainer) Creates and register aSharedInstance
.@Nullable Instance
getInstance
(UUID uuid) Gets an instance by the given UUID.Gets all the registered instances.void
registerInstance
(Instance instance) Registers anInstance
internally.registerSharedInstance
(SharedInstance sharedInstance) Registers aSharedInstance
.void
unregisterInstance
(Instance instance) Unregisters theInstance
internally.
-
Constructor Details
-
InstanceManager
-
-
Method Details
-
registerInstance
Registers anInstance
internally.Note: not necessary if you created your instance using
createInstanceContainer()
orcreateSharedInstance(InstanceContainer)
but only if you instantiated your instance object manually- Parameters:
instance
- theInstance
to register
-
createInstanceContainer
public InstanceContainer createInstanceContainer(RegistryKey<DimensionType> dimensionType, @Nullable @Nullable IChunkLoader loader) Creates and register anInstanceContainer
with the specifiedDimensionType
.- Parameters:
dimensionType
- theDimensionType
of the instanceloader
- the chunk loader- Returns:
- the created
InstanceContainer
-
createInstanceContainer
-
createInstanceContainer
-
createInstanceContainer
Creates and register anInstanceContainer
.- Returns:
- the created
InstanceContainer
-
unregisterInstance
Unregisters theInstance
internally.If
instance
is anInstanceContainer
all chunks are unloaded.- Parameters:
instance
- theInstance
to unregister
-
getInstances
Gets all the registered instances.- Returns:
- an unmodifiable
Set
containing all the registered instances
-
getInstance
Gets an instance by the given UUID.- Parameters:
uuid
- UUID of the instance- Returns:
- the instance with the given UUID, null if not found
-