summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-27 22:09:30 +0200
committermadmaxoft <github@xoft.cz>2014-05-27 22:09:30 +0200
commitdff71823d40690b676a617025c5fb70b7eeaf209 (patch)
treeeda6ddf26d9e24b634a5940b3d2a0fbb72148ffb /src/Protocol
parentAdded AlchemistVillage prefabs (Thanks, KingsCraftAu). (diff)
parentStuff. (diff)
downloadcuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar.gz
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar.bz2
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar.lz
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar.xz
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.tar.zst
cuberite-dff71823d40690b676a617025c5fb70b7eeaf209.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol17x.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 39feee16f..7c526d103 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -234,7 +234,7 @@ void cProtocol172::SendChat(const cCompositeChat & a_Message)
// Compose the complete Json string to send:
Json::Value msg;
- msg["text"] = ""; // The client crashes without this
+ msg["text"] = cClientHandle::FormatMessageType(m_Client->GetPlayer()->GetWorld()->ShouldUseChatPrefixes(), a_Message.GetMessageType(), a_Message.GetAdditionalMessageTypeData()); // The client crashes without this field being present
const cCompositeChat::cParts & Parts = a_Message.GetParts();
for (cCompositeChat::cParts::const_iterator itr = Parts.begin(), end = Parts.end(); itr != end; ++itr)
{
@@ -289,6 +289,35 @@ void cProtocol172::SendChat(const cCompositeChat & a_Message)
AddChatPartStyle(Part, p.m_Style);
break;
}
+
+ case cCompositeChat::ptShowAchievement:
+ {
+ const cCompositeChat::cShowAchievementPart & p = (const cCompositeChat::cShowAchievementPart &)**itr;
+ Part["translate"] = "chat.type.achievement";
+
+ Json::Value Ach;
+ Ach["action"] = "show_achievement";
+ Ach["value"] = p.m_Text;
+
+ Json::Value AchColourAndName;
+ AchColourAndName["color"] = "green";
+ AchColourAndName["translate"] = p.m_Text;
+ AchColourAndName["hoverEvent"] = Ach;
+
+ Json::Value Extra;
+ Extra.append(AchColourAndName);
+
+ Json::Value Name;
+ Name["text"] = p.m_PlayerName;
+
+ Json::Value With;
+ With.append(Name);
+ With.append(Extra);
+
+ Part["with"] = With;
+ AddChatPartStyle(Part, p.m_Style);
+ break;
+ }
}
msg["extra"].append(Part);
} // for itr - Parts[]