|There is still documentation to be done here!! If you feel up to the task, please have a go at it. Specifically what needs to be added is:|
Fill in articles for all API events
|BZFS API Documentation This page contains part of the BZFS API documentation for use by Plug-ins on the BZFS server.|
API events are callbacks that a plug-in can install into BZFS to be called in response to specific actions or state changes in the server side game world. Events are the primary method of communication from BZFS to installed plug-ins. Specific events exist for nearly all logical actions that can happen during a game of BZFlag.
Installation and Removal
The callbacks for events are typically installed during the bz_Load entry point in a plug-in, so they can be active when a plug-in is first loaded.
The plug-in must call the function;
BZF_API bool bz_registerEvent ( bz_eEventType eventType, bz_EventHandler* eventHandler );
The plug-in registers and event callback derived from bz_EventHandler for each specific event types it wishes to monitor.
When a plug-in no longer needs to monitor an event, or when it is unloaded in the bz_Unload entry point, the plug-in must remove the installed callback by calling the function;
BZF_API bool bz_removeEvent ( bz_eEventType eventType, bz_EventHandler* eventHandler );
The plug-in must define a class that is derived from bz_EventHandler and pass a pointer to an object of that class when ever it registers an event callback.
When ever a specific event is triggered, BZFS will call the 'process' method of the installed callback class.
virtual void process ( bz_EventData *eventData ) = 0;
With each call to the 'process' method of the installed event handler, BZFS will pass the plug-in a pointer to a class that contains all the data provided by the event. Each event derives a specific data class from bz_EventData that contains the specific member variables that contain the data. The base class bz_EventData contains the data member;
This data member allows a plug-in to identify the specific event and cast the 'bz_EventData' pointer to the appropriate specific data class. This is usefull for plug-ins that use the same 'bz_EventHandler' to process more then one specific message.
Please see the descriptions of each specific event for information and descriptions of the data classes for each event. Some specific events allow plug-ins to change the values of data members in the data class and will use the modified values instead.
Plug-ins should never delete or free the memory for a data class. BZFS will manage all pointers passed to plug-ins.
The following list contains all the event types currently supported by BZFS version 2.1
bz_eNullEvent bz_eCaptureEvent bz_ePlayerDieEvent bz_ePlayerSpawnEvent bz_eZoneEntryEvent bz_eZoneExitEvent bz_ePlayerJoinEvent bz_ePlayerPartEvent bz_eRawChatMessageEvent bz_eFilteredChatMessageEvent bz_eUnknownSlashCommand bz_eGetPlayerSpawnPosEvent bz_eGetAutoTeamEvent bz_eAllowPlayer bz_eTickEvent bz_eGetWorldEvent bz_eGetPlayerInfoEvent bz_eAllowSpawn bz_eListServerUpdateEvent bz_eBanEvent bz_eHostBanEvent bz_eKickEvent bz_eKillEvent bz_ePlayerPausedEvent bz_eMessageFilteredEvent bz_eGameStartEvent bz_eGameEndEvent bz_eSlashCommandEvent bz_ePlayerAuthEvent bz_eServerMsgEvent bz_eShotFiredEvent bz_eAnointRabbitEvent bz_eNewRabbitEvent bz_eReloadEvent bz_ePlayerUpdateEvent bz_eNetDataSendEvent bz_eNetDataReceveEvent bz_eLoggingEvent bz_eFlagTransferredEvent bz_eFlagGrabbedEvent bz_eFlagDroppedEvent bz_eShotEndedEvent bz_eNewNonPlayerConnection bz_eIdleNewNonPlayerConnection bz_ePlayerCollision bz_eFlagResetEvent bz_eWorldFinalized bz_eAllowCTFCaptureEvent
There exists one additional event in the 'bz_eEventType' enumeration in 'bzfsAPI.h', bz_eLastEvent. This event is simply used by BZFS to assist in the counting of the total number of events, it will never be called and can not be installed.