Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <Scoreboard.h>
Public Types | |
enum | eDisplaySlot { dsList = 0 , dsSidebar , dsName , dsCount } |
Public Member Functions | |
void | AddPlayerScore (const AString &a_Name, cObjective::eType a_Type, cObjective::Score a_Value=1) |
cScoreboard (cWorld *a_World) | |
bool | ForEachObjective (cObjectiveCallback a_Callback) |
Execute callback for each objective. More... | |
bool | ForEachObjectiveWith (cObjective::eType a_Type, cObjectiveCallback a_Callback) |
Execute callback for each objective with the specified type Returns true if all objectives processed, false if the callback aborted by returning true. More... | |
bool | ForEachTeam (cTeamCallback a_Callback) |
Execute callback for each team. More... | |
size_t | GetNumObjectives (void) const |
size_t | GetNumTeams (void) const |
cObjective * | GetObjective (const AString &a_Name) |
Retrieves the objective with the specified name, nullptr if not found. More... | |
cObjective * | GetObjectiveIn (eDisplaySlot a_Slot) |
cTeam * | GetTeam (const AString &a_Name) |
Retrieves the team with the specified name, nullptr if not found. More... | |
AStringVector | GetTeamNames () |
Retrieves the list of team names. More... | |
cTeam * | QueryPlayerTeam (const AString &a_Name) |
cObjective * | RegisterObjective (const AString &a_Name, const AString &a_DisplayName, cObjective::eType a_Type) |
Registers a new scoreboard objective, returns the cObjective instance, nullptr on name collision. More... | |
cTeam * | RegisterTeam (const AString &a_Name, const AString &a_DisplayName, const AString &a_Prefix, const AString &a_Suffix) |
Registers a new team, returns the cTeam instance, nullptr on name collision. More... | |
bool | RemoveObjective (const AString &a_Name) |
Removes a registered objective, returns true if operation was successful. More... | |
bool | RemoveTeam (const AString &a_Name) |
Removes a registered team, returns true if operation was successful. More... | |
void | SendTo (cClientHandle &a_Client) |
Send this scoreboard to the specified client. More... | |
void | SetDisplay (cObjective *a_Objective, eDisplaySlot a_Slot) |
void | SetDisplay (const AString &a_Objective, eDisplaySlot a_Slot) |
Private Types | |
typedef std::pair< AString, cObjective > | cNamedObjective |
typedef std::pair< AString, cTeam > | cNamedTeam |
typedef std::map< AString, cObjective > | cObjectiveMap |
typedef std::map< AString, cTeam > | cTeamMap |
Private Attributes | |
cCriticalSection | m_CSObjectives |
cCriticalSection | m_CSTeams |
cObjective * | m_Display [dsCount] |
cObjectiveMap | m_Objectives |
cTeamMap | m_Teams |
cWorld * | m_World |
Friends | |
class | cScoreboardSerializer |
Definition at line 199 of file Scoreboard.h.
|
private |
Definition at line 276 of file Scoreboard.h.
|
private |
Definition at line 277 of file Scoreboard.h.
|
private |
Definition at line 279 of file Scoreboard.h.
|
private |
Definition at line 280 of file Scoreboard.h.
Enumerator | |
---|---|
dsList | |
dsSidebar | |
dsName | |
dsCount |
Definition at line 203 of file Scoreboard.h.
cScoreboard::cScoreboard | ( | cWorld * | a_World | ) |
Definition at line 273 of file Scoreboard.cpp.
void cScoreboard::AddPlayerScore | ( | const AString & | a_Name, |
cObjective::eType | a_Type, | ||
cObjective::Score | a_Value = 1 |
||
) |
Definition at line 550 of file Scoreboard.cpp.
bool cScoreboard::ForEachObjective | ( | cObjectiveCallback | a_Callback | ) |
Execute callback for each objective.
Returns true if all objectives have been processed, false if the callback aborted by returning true.
Definition at line 512 of file Scoreboard.cpp.
bool cScoreboard::ForEachObjectiveWith | ( | cObjective::eType | a_Type, |
cObjectiveCallback | a_Callback | ||
) |
Execute callback for each objective with the specified type Returns true if all objectives processed, false if the callback aborted by returning true.
Definition at line 490 of file Scoreboard.cpp.
bool cScoreboard::ForEachTeam | ( | cTeamCallback | a_Callback | ) |
Execute callback for each team.
Returns true if all teams have been processed, false if the callback aborted by returning true.
Definition at line 531 of file Scoreboard.cpp.
size_t cScoreboard::GetNumObjectives | ( | void | ) | const |
Definition at line 592 of file Scoreboard.cpp.
size_t cScoreboard::GetNumTeams | ( | void | ) | const |
Definition at line 601 of file Scoreboard.cpp.
cObjective * cScoreboard::GetObjective | ( | const AString & | a_Name | ) |
Retrieves the objective with the specified name, nullptr if not found.
Definition at line 339 of file Scoreboard.cpp.
cObjective * cScoreboard::GetObjectiveIn | ( | eDisplaySlot | a_Slot | ) |
Definition at line 479 of file Scoreboard.cpp.
Retrieves the team with the specified name, nullptr if not found.
Definition at line 399 of file Scoreboard.cpp.
AStringVector cScoreboard::GetTeamNames | ( | ) |
Retrieves the list of team names.
Definition at line 419 of file Scoreboard.cpp.
Definition at line 435 of file Scoreboard.cpp.
cObjective * cScoreboard::RegisterObjective | ( | const AString & | a_Name, |
const AString & | a_DisplayName, | ||
cObjective::eType | a_Type | ||
) |
Registers a new scoreboard objective, returns the cObjective instance, nullptr on name collision.
Definition at line 285 of file Scoreboard.cpp.
cTeam * cScoreboard::RegisterTeam | ( | const AString & | a_Name, |
const AString & | a_DisplayName, | ||
const AString & | a_Prefix, | ||
const AString & | a_Suffix | ||
) |
Registers a new team, returns the cTeam instance, nullptr on name collision.
Definition at line 359 of file Scoreboard.cpp.
bool cScoreboard::RemoveObjective | ( | const AString & | a_Name | ) |
Removes a registered objective, returns true if operation was successful.
Definition at line 308 of file Scoreboard.cpp.
bool cScoreboard::RemoveTeam | ( | const AString & | a_Name | ) |
Removes a registered team, returns true if operation was successful.
Definition at line 379 of file Scoreboard.cpp.
void cScoreboard::SendTo | ( | cClientHandle & | a_Client | ) |
Send this scoreboard to the specified client.
Definition at line 567 of file Scoreboard.cpp.
void cScoreboard::SetDisplay | ( | cObjective * | a_Objective, |
eDisplaySlot | a_Slot | ||
) |
Definition at line 467 of file Scoreboard.cpp.
void cScoreboard::SetDisplay | ( | const AString & | a_Objective, |
eDisplaySlot | a_Slot | ||
) |
Definition at line 454 of file Scoreboard.cpp.
|
friend |
Definition at line 293 of file Scoreboard.h.
|
private |
Definition at line 283 of file Scoreboard.h.
|
private |
Definition at line 286 of file Scoreboard.h.
|
private |
Definition at line 291 of file Scoreboard.h.
|
private |
Definition at line 284 of file Scoreboard.h.
|
private |
Definition at line 287 of file Scoreboard.h.
|
private |
Definition at line 289 of file Scoreboard.h.