diff options
author | Mattes D <github@xoft.cz> | 2014-01-22 15:05:17 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-01-22 15:05:17 +0100 |
commit | 26586fdb92c7924e47debf6946fbdbe06775ae19 (patch) | |
tree | 093a0fa1ad5de0cc2e7dd90f49a3a3ab6429ac5b /src/Protocol/Protocol15x.cpp | |
parent | InfoDump: Can dump a single plugin without LFS. (diff) | |
parent | cWorld now saves/loads the scoreboard (diff) | |
download | cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar.gz cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar.bz2 cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar.lz cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar.xz cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.tar.zst cuberite-26586fdb92c7924e47debf6946fbdbe06775ae19.zip |
Diffstat (limited to 'src/Protocol/Protocol15x.cpp')
-rw-r--r-- | src/Protocol/Protocol15x.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/Protocol/Protocol15x.cpp b/src/Protocol/Protocol15x.cpp index 0f1e59f10..c33aec7d5 100644 --- a/src/Protocol/Protocol15x.cpp +++ b/src/Protocol/Protocol15x.cpp @@ -35,8 +35,11 @@ Implements the 1.5.x protocol classes: enum { - PACKET_WINDOW_OPEN = 0x64, - PACKET_PARTICLE_EFFECT = 0x3F, + PACKET_WINDOW_OPEN = 0x64, + PACKET_PARTICLE_EFFECT = 0x3F, + PACKET_SCOREBOARD_OBJECTIVE = 0x3B, + PACKET_SCORE_UPDATE = 0x3C, + PACKET_DISPLAY_OBJECTIVE = 0x3D } ; @@ -97,6 +100,53 @@ void cProtocol150::SendParticleEffect(const AString & a_ParticleName, float a_Sr +void cProtocol150::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SCOREBOARD_OBJECTIVE); + WriteString(a_Name); + WriteString(a_DisplayName); + WriteByte(a_Mode); + Flush(); +} + + + + + +void cProtocol150::SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SCORE_UPDATE); + WriteString(a_Player); + WriteByte(a_Mode); + + if (a_Mode != 1) + { + WriteString(a_Objective); + WriteInt((int) a_Score); + } + + Flush(); +} + + + + + +void cProtocol150::SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_DISPLAY_OBJECTIVE); + WriteByte((int) a_Display); + WriteString(a_Objective); + Flush(); +} + + + + + int cProtocol150::ParseWindowClick(void) { HANDLE_PACKET_READ(ReadChar, char, WindowID); |