VitalMinigameInstance
Defines a single game instance that can be hosted on the server. Each instance can have n-amount of states, but only one active state at a given time. Every state may have n-amount of event handlers, which will only fire when their state is currently active on an instance. Every instance will be bound to its own world for proper instance capsulation.
An instance in itself is also a listener and can receive game events independently on which state is currently active.
Switching to a state will register all defined event handlers for the new state, and unregister all from the old one.
Properties
Functions
Checks if the given state is active by its class.
Lifecycle function; called when this instance is registered on the global VitalMinigameInstanceService bean. Can be used to perform custom logic during instance registration.
Lifecycle function; called when this instance is unregistered on the global VitalMinigameInstanceService bean. Can be used to perform custom logic during instance unregistration.
Registers all declared event handlers for this state and then calls onRegister.
Sets the state of this instance to the given state.
Unregisters all registered event handlers from this state and then calls onUnregister.