Package net.minestom.server.instance
Class InstanceManager
java.lang.Object
net.minestom.server.instance.InstanceManager
Used to register
Instance.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull InstanceContainerCreates and register anInstanceContainer.@NotNull InstanceContainercreateInstanceContainer(@Nullable IChunkLoader loader) @NotNull InstanceContainercreateInstanceContainer(@NotNull DimensionType dimensionType) @NotNull InstanceContainercreateInstanceContainer(@NotNull DimensionType dimensionType, @Nullable IChunkLoader loader) Creates and register anInstanceContainerwith the specifiedDimensionType.@NotNull SharedInstancecreateSharedInstance(@NotNull InstanceContainer instanceContainer) Creates and register aSharedInstance.@Nullable InstancegetInstance(@NotNull UUID uuid) Gets an instance by the given UUID.Gets all the registered instances.voidregisterInstance(@NotNull Instance instance) Registers anInstanceinternally.@NotNull SharedInstanceregisterSharedInstance(@NotNull SharedInstance sharedInstance) Registers aSharedInstance.voidunregisterInstance(@NotNull Instance instance) Unregisters theInstanceinternally.
-
Constructor Details
-
InstanceManager
public InstanceManager()
-
-
Method Details
-
registerInstance
Registers anInstanceinternally.Note: not necessary if you created your instance using
createInstanceContainer()orcreateSharedInstance(InstanceContainer)but only if you instantiated your instance object manually- Parameters:
instance- theInstanceto register
-
createInstanceContainer
@Experimental @NotNull public @NotNull InstanceContainer createInstanceContainer(@NotNull @NotNull DimensionType dimensionType, @Nullable @Nullable IChunkLoader loader) Creates and register anInstanceContainerwith the specifiedDimensionType.- Parameters:
dimensionType- theDimensionTypeof the instanceloader- the chunk loader- Returns:
- the created
InstanceContainer
-
createInstanceContainer
@NotNull public @NotNull InstanceContainer createInstanceContainer(@NotNull @NotNull DimensionType dimensionType) -
createInstanceContainer
@Experimental @NotNull public @NotNull InstanceContainer createInstanceContainer(@Nullable @Nullable IChunkLoader loader) -
createInstanceContainer
Creates and register anInstanceContainer.- Returns:
- the created
InstanceContainer
-
unregisterInstance
Unregisters theInstanceinternally.If
instanceis anInstanceContainerall chunks are unloaded.- Parameters:
instance- theInstanceto unregister
-
getInstances
Gets all the registered instances.- Returns:
- an unmodifiable
Setcontaining 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
-