⚡Using events
LabAPI is an event based framework. You can hook into these events to edit their parameters and access them as they are triggered.
Before using events
Before using events, you will have to subscribe your handlers to the desired events. There are currently two ways of registering events in LabAPI.
⚡Legacy Events⚡Custom Event HandlersYou can choose the one you like the most. Meanwhile, a custom events handler may be easier to work with for beginners, legacy events can give more freedom in the development stage.
Using events
Each event has a different usage. Whenever you subscribe a method to an event it should have an event argument parameter following the next example:
void OnWaveRespawned(WaveRespawnedEventArgs args)
{
// Your code
}Some events don't have any type of argument, these events include ServerEvents.RoundStarted, ServerEvents.WaitingForPlayers...
Using the arguments
Each argument has different properties you may use for your advantage
Some event arguments have a special property: IsAllowed which allows events to be cancelled:
Cancellable events usually end with -ing
All the properties in the event arguments that have setters can be freely edited.
Wow! You learn fast. That is all events provide, go ahead and test them out!
Last updated
Was this helpful?