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 (const AString &a_Objective, eDisplaySlot a_Slot) |
void | SetDisplay (cObjective *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 208 of file Scoreboard.h.
|
private |
Definition at line 285 of file Scoreboard.h.
|
private |
Definition at line 286 of file Scoreboard.h.
|
private |
Definition at line 288 of file Scoreboard.h.
|
private |
Definition at line 289 of file Scoreboard.h.
Enumerator | |
---|---|
dsList | |
dsSidebar | |
dsName | |
dsCount |
Definition at line 212 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 546 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 508 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 486 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 527 of file Scoreboard.cpp.
size_t cScoreboard::GetNumObjectives | ( | void | ) | const |
Definition at line 588 of file Scoreboard.cpp.
size_t cScoreboard::GetNumTeams | ( | void | ) | const |
Definition at line 597 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 475 of file Scoreboard.cpp.
Retrieves the team with the specified name, nullptr if not found.
Definition at line 395 of file Scoreboard.cpp.
AStringVector cScoreboard::GetTeamNames | ( | ) |
Retrieves the list of team names.
Definition at line 415 of file Scoreboard.cpp.
Definition at line 431 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 375 of file Scoreboard.cpp.
void cScoreboard::SendTo | ( | cClientHandle & | a_Client | ) |
Send this scoreboard to the specified client.
Definition at line 563 of file Scoreboard.cpp.
void cScoreboard::SetDisplay | ( | const AString & | a_Objective, |
eDisplaySlot | a_Slot | ||
) |
Definition at line 450 of file Scoreboard.cpp.
void cScoreboard::SetDisplay | ( | cObjective * | a_Objective, |
eDisplaySlot | a_Slot | ||
) |
Definition at line 463 of file Scoreboard.cpp.
|
friend |
Definition at line 302 of file Scoreboard.h.
|
private |
Definition at line 292 of file Scoreboard.h.
|
private |
Definition at line 295 of file Scoreboard.h.
|
private |
Definition at line 300 of file Scoreboard.h.
|
private |
Definition at line 293 of file Scoreboard.h.
|
private |
Definition at line 296 of file Scoreboard.h.
|
private |
Definition at line 298 of file Scoreboard.h.