Skip to content

InstanceModule

InstanceModule is an abstract module that supplies instances to the game. It cannot be used by itself, but BlueDragon includes several implementations.

Implementations

Public Methods

getRequiredInstances

open fun getRequiredInstances(): Iterable<Instance>

Returns a set of instances that are required, but not owned, by this module. This is necessary because shared instances must have a registered instance container for chunk loading, but the instance container can be used by multiple games at the same time (and therefore not “owned” by any game). Returns an empty set if not overridden.

getSpawningInstance

abstract fun getSpawningInstance(player: Player): Instance

Returns the instance that a player should spawn in when initially joining the game.

ownsInstance

abstract fun ownsInstance(instance: Instance): Boolean

Returns true if this module “owns” the instance. Modules should own an instance if they created it, and ownership should be released when the instance is no longer needed. Instances with no modules that declare ownership of them may be cleaned up at any time.