Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
EventManager Class Reference

Handles events (callbacks) from server to plugins. More...

#include <EventManager.h>

Public Member Functions

 EventManager ()
 
int RegisterPlayerConnect (std::vector< std::function< void(Player)>> functions)
 Register functions for the PlayerConnect callback. More...
 
int RegisterPlayerDisconnect (std::vector< std::function< void(Player)>> functions)
 Register functions for the PlayerDisconnect callback. More...
 
int RegisterPlayerChat (std::vector< std::function< void(Player, std::string)>> functions)
 Register functions for the PlayerChat callback. More...
 
int RegisterPlayerManialinkPageAnswer (std::vector< std::function< void(Player, std::string, std::vector< EntryVal >)>> functions)
 Register functions for the PlayerManialinkPageAnswer callback. More...
 
int RegisterEcho (std::vector< std::function< void(std::string, std::string)>> functions)
 Register functions for the Echo callback. More...
 
int RegisterBeginMatch (std::vector< std::function< void()>> functions)
 Register functions for the BeginMatch callback. More...
 
int RegisterEndMatch (std::vector< std::function< void(std::vector< PlayerRanking >, int)>> functions)
 Register functions for the EndMatch callback. More...
 
int RegisterBeginMap (std::vector< std::function< void(Map)>> functions)
 Register functions for the BeginMap callback. More...
 
int RegisterEndMap (std::vector< std::function< void(Map)>> functions)
 Register functions for the EndMap callback. More...
 
int RegisterStatusChanged (std::vector< std::function< void(int, std::string)>> functions)
 Register functions for the StatusChanged callback. More...
 
int RegisterPlayerCheckpoint (std::vector< std::function< void(Player, int, int, int)>> functions)
 Register functions for the PlayerCheckpoint callback. More...
 
int RegisterPlayerFinish (std::vector< std::function< void(Player, int)>> functions)
 Register functions for the PlayerFinish callback. More...
 
int RegisterPlayerIncoherence (std::vector< std::function< void(Player)>> functions)
 Register functions for the PlayerIncoherence callback. More...
 
int RegisterBillUpdated (std::vector< std::function< void(int, int, std::string, int)>> functions)
 Register functions for the BillUpdated callback. More...
 
int RegisterMapListModified (std::vector< std::function< void(int, int, bool)>> functions)
 Register functions for the MapListModified callback. More...
 
int RegisterPlayerInfoChanged (std::vector< std::function< void(Player)>> functions)
 Register functions for the PlayerInfoChanged callback. More...
 
int RegisterVoteUpdated (std::vector< std::function< void(std::string, std::string, std::string, std::string)>> functions)
 Register functions for the VoteUpdated callback. More...
 
void CallPlayerConnect (Player player)
 Calls all functions which are subscribed to the PlayerConnect event. More...
 
void CallPlayerDisconnect (Player player)
 Calls all functions which are subscribed to the PlayerDisconnect event. More...
 
void CallPlayerChat (Player player, std::string text, bool isRegisteredCommand)
 Calls all functions which are subscribed to the PlayerChat event. More...
 
void CallPlayerManialinkPageAnswer (Player player, std::string answer, std::vector< EntryVal > entries)
 Calls all functions which are subscribed to the PlayerManialinkPageAnswer event. More...
 
void CallEcho (std::string internal, std::string publicEcho)
 Calls all functions which are subscribed to the Echo event. More...
 
void CallBeginMatch ()
 Calls all functions which are subscribed to the BeginMatch event.
 
void CallEndMatch (std::vector< PlayerRanking > rankings, int winnerTeam)
 Calls all functions which are subscribed to the EndMatch event. More...
 
void CallBeginMap (Map map)
 Calls all functions which are subscribed to the EndMatch event. More...
 
void CallEndMap (Map map)
 Calls all functions which are subscribed to the EndMap event. More...
 
void CallStatusChanged (int statusCode, std::string statusName)
 Calls all functions which are subscribed to the StatusChanged event. More...
 
void CallPlayerCheckpoint (Player player, int time, int currentLap, int checkpointIndex)
 Calls all functions which are subscribed to the PlayerCheckpoint event. More...
 
void CallPlayerFinish (Player player, int time)
 Calls all functions which are subscribed to the PlayerFinish event. More...
 
void CallPlayerIncoherence (Player player)
 Calls all functions which are subscribed to the PlayerIncoherence event. More...
 
void CallBillUpdated (int billId, int state, std::string stateName, int transactionId)
 Calls all functions which are subscribed to the BillUpdated event. More...
 
void CallMapListModified (int currentMap, int nextMap, bool listModified)
 Calls all functions which are subscribed to the MapListModified event. More...
 
void CallPlayerInfoChanged (Player player)
 Calls all functions which are subscribed to the PlayerInfoChanged event. More...
 
void CallVoteUpdated (std::string stateName, std::string login, std::string commandName, std::string commandParam)
 Calls all functions which are subscribed to the VoteUpdated event. More...
 

Private Attributes

std::vector< std::function
< void(Player)> > 
methodsPlayerConnect
 Vector with functions for the PlayerConnect event.
 
std::vector< std::function
< void(Player)> > 
methodsPlayerDisconnect
 Vector with functions for the PlayerDisconnect event.
 
std::vector< std::function
< void(Player, std::string)> > 
methodsPlayerChat
 Vector with functions for the PlayerChat event.
 
std::vector< std::function
< void(Player, std::string,
std::vector< EntryVal >)> > 
methodsPlayerManialinkPageAnswer
 Vector with functions for the PlayerManialinkPageAnswer event.
 
std::vector< std::function
< void(std::string,
std::string)> > 
methodsEcho
 Vector with functions for the Echo event.
 
std::vector< std::function
< void()> > 
methodsBeginMatch
 Vector with functions for the BeginMatch event.
 
std::vector< std::function
< void(std::vector
< PlayerRanking >, int)> > 
methodsEndMatch
 Vector with functions for the EndMatch event.
 
std::vector< std::function
< void(Map)> > 
methodsBeginMap
 Vector with functions for the BeginMap event.
 
std::vector< std::function
< void(Map)> > 
methodsEndMap
 Vector with functions for the EndMap event.
 
std::vector< std::function
< void(int, std::string)> > 
methodsStatusChanged
 Vector with functions for the StatusChanged event.
 
std::vector< std::function
< void(Player, int, int, int)> > 
methodsPlayerCheckpoint
 Vector with functions for the PlayerCheckpoint event.
 
std::vector< std::function
< void(Player, int)> > 
methodsPlayerFinish
 Vector with functions for the PlayerFinish event.
 
std::vector< std::function
< void(Player)> > 
methodsPlayerIncoherence
 Vector with functions for the PlayerIncoherence event.
 
std::vector< std::function
< void(int, int, std::string,
int)> > 
methodsBillUpdated
 Vector with functions for the BillUpdated event.
 
std::vector< std::function
< void(int, int, bool)> > 
methodsMapListModified
 Vector with functions for the MapListModified event.
 
std::vector< std::function
< void(Player)> > 
methodsPlayerInfoChanged
 Vector with functions for the PlayerInfoChanged event.
 
std::vector< std::function
< void(std::string,
std::string, std::string,
std::string)> > 
methodsVoteUpdated
 Vector with functions for the VoteUpdated event.
 

Detailed Description

Handles events (callbacks) from server to plugins.

Constructor & Destructor Documentation

EventManager::EventManager ( )

Simple constructor.

Member Function Documentation

void EventManager::CallBeginMap ( Map  map)

Calls all functions which are subscribed to the EndMatch event.

Parameters
mapNew current map.
void EventManager::CallBillUpdated ( int  billId,
int  state,
std::string  stateName,
int  transactionId 
)

Calls all functions which are subscribed to the BillUpdated event.

Parameters
billIdBill identifier.
stateNew bill state.
stateNameNew bill state name.
transactionIdTransaction identifier.
void EventManager::CallEcho ( std::string  internal,
std::string  publicEcho 
)

Calls all functions which are subscribed to the Echo event.

Parameters
internalInternal.
publicEchoPublic.
void EventManager::CallEndMap ( Map  map)

Calls all functions which are subscribed to the EndMap event.

Parameters
mapNew current map.
void EventManager::CallEndMatch ( std::vector< PlayerRanking rankings,
int  winnerTeam 
)

Calls all functions which are subscribed to the EndMatch event.

Parameters
rankingsPlayer rankings.
winnerTeamWinning team.
void EventManager::CallMapListModified ( int  currentMap,
int  nextMap,
bool  listModified 
)

Calls all functions which are subscribed to the MapListModified event.

Parameters
currentMapCurrent map index.
nextMapNext map index.
listModifiedIs maplist modified?
void EventManager::CallPlayerChat ( Player  player,
std::string  text,
bool  isRegisteredCommand 
)

Calls all functions which are subscribed to the PlayerChat event.

Parameters
playerPlayer that wrote a chat message.
textChat message.
isRegisteredCommandIs the chat message a registered command?
void EventManager::CallPlayerCheckpoint ( Player  player,
int  time,
int  currentLap,
int  checkpointIndex 
)

Calls all functions which are subscribed to the PlayerCheckpoint event.

Parameters
playerPlayer object.
timeCheckpoint time.
currentLapCurrent lap number.
checkpointIndexCurrent checkpoint number.
void EventManager::CallPlayerConnect ( Player  player)

Calls all functions which are subscribed to the PlayerConnect event.

Parameters
playerPlayer that connected.
void EventManager::CallPlayerDisconnect ( Player  player)

Calls all functions which are subscribed to the PlayerDisconnect event.

Parameters
playerPlayer that disconnected.
void EventManager::CallPlayerFinish ( Player  player,
int  time 
)

Calls all functions which are subscribed to the PlayerFinish event.

Parameters
playerPlayer object.
timeFinish time.
void EventManager::CallPlayerIncoherence ( Player  player)

Calls all functions which are subscribed to the PlayerIncoherence event.

Parameters
playerPlayer object.
void EventManager::CallPlayerInfoChanged ( Player  player)

Calls all functions which are subscribed to the PlayerInfoChanged event.

Parameters
playerPlayer object.
void EventManager::CallPlayerManialinkPageAnswer ( Player  player,
std::string  answer,
std::vector< EntryVal entries 
)

Calls all functions which are subscribed to the PlayerManialinkPageAnswer event.

Parameters
playerPlayer who created the answer.
answerManiaLink answer.
entriesList of entries.
void EventManager::CallStatusChanged ( int  statusCode,
std::string  statusName 
)

Calls all functions which are subscribed to the StatusChanged event.

Parameters
statusCodeNew status code.
statusNameNew status name.
void EventManager::CallVoteUpdated ( std::string  stateName,
std::string  login,
std::string  commandName,
std::string  commandParam 
)

Calls all functions which are subscribed to the VoteUpdated event.

Parameters
stateNameVote state name.
loginPlayer login. (?)
commandNameName of command.
commandParamParameter for command.
int EventManager::RegisterBeginMap ( std::vector< std::function< void(Map)>>  functions)

Register functions for the BeginMap callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterBeginMatch ( std::vector< std::function< void()>>  functions)

Register functions for the BeginMatch callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterBillUpdated ( std::vector< std::function< void(int, int, std::string, int)>>  functions)

Register functions for the BillUpdated callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterEcho ( std::vector< std::function< void(std::string, std::string)>>  functions)

Register functions for the Echo callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterEndMap ( std::vector< std::function< void(Map)>>  functions)

Register functions for the EndMap callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterEndMatch ( std::vector< std::function< void(std::vector< PlayerRanking >, int)>>  functions)

Register functions for the EndMatch callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterMapListModified ( std::vector< std::function< void(int, int, bool)>>  functions)

Register functions for the MapListModified callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerChat ( std::vector< std::function< void(Player, std::string)>>  functions)

Register functions for the PlayerChat callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerCheckpoint ( std::vector< std::function< void(Player, int, int, int)>>  functions)

Register functions for the PlayerCheckpoint callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerConnect ( std::vector< std::function< void(Player)>>  functions)

Register functions for the PlayerConnect callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerDisconnect ( std::vector< std::function< void(Player)>>  functions)

Register functions for the PlayerDisconnect callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerFinish ( std::vector< std::function< void(Player, int)>>  functions)

Register functions for the PlayerFinish callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerIncoherence ( std::vector< std::function< void(Player)>>  functions)

Register functions for the PlayerIncoherence callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerInfoChanged ( std::vector< std::function< void(Player)>>  functions)

Register functions for the PlayerInfoChanged callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterPlayerManialinkPageAnswer ( std::vector< std::function< void(Player, std::string, std::vector< EntryVal >)>>  functions)

Register functions for the PlayerManialinkPageAnswer callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterStatusChanged ( std::vector< std::function< void(int, std::string)>>  functions)

Register functions for the StatusChanged callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.
int EventManager::RegisterVoteUpdated ( std::vector< std::function< void(std::string, std::string, std::string, std::string)>>  functions)

Register functions for the VoteUpdated callback.

Returns how many functions were successfully added.

Parameters
functionsVector with functions to be added.

The documentation for this class was generated from the following files: