Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
ChatMessage Class Reference

Minecraft Chat Message implementation. More...

#include <chatmessage.h>

Classes

class  ClickEvent
 Click Event. More...
 

Public Member Functions

 ChatMessage ()
 Construct a new Chat Message object.
 
 ChatMessage (const std::string &msg)
 Construct a new Chat Message object.
 
 ChatMessage (const std::string &&msg)
 Construct a new Chat Message object.
 
 ~ChatMessage ()
 Destroy the Chat Message object.
 
void addExtra (ChatMessage *cm)
 Adds an extra.
 
void load (const rapidjson::Value &document)
 Loads data from a document.
 
void save (rapidjson::Value &document, rapidjson::Document::AllocatorType &alloc) const
 Saves data from a document.
 

Static Public Member Functions

static void loadLua (lua_State *state, const char *namespaceName)
 Loads the ChatMessage class to a Lua one.
 

Public Attributes

bool bold {}
 Boldness for text.
 
bool italic {}
 Italicness for text.
 
bool underlined {}
 Underline or not text.
 
bool strikethrough {}
 Strikethrough or not text.
 
bool obfuscated {}
 Obfuscate or not text.
 
std::string color {}
 Color of text.
 
std::string insertion {}
 Text to insert.
 
std::string text {}
 The text excluding extras.
 
ClickEvent clickEvent
 Click event for message.
 

Friends

bool operator== (const ChatMessage &lhs, const ChatMessage &rhs)
 Equality operator between two chat messages.
 

Detailed Description

Minecraft Chat Message implementation.

Following great Wiki.vg article on the implementation of Minecraft's chat system.

Constructor & Destructor Documentation

◆ ChatMessage() [1/2]

ChatMessage::ChatMessage ( const std::string & msg)

Construct a new Chat Message object.

Parameters
msgthe text of the chat message

◆ ChatMessage() [2/2]

ChatMessage::ChatMessage ( const std::string && msg)

Construct a new Chat Message object.

Parameters
msgthe text of the chat message

Member Function Documentation

◆ addExtra()

void ChatMessage::addExtra ( ChatMessage * cm)

Adds an extra.

Adds additional data to the chat message with another ChatMessage

Parameters
cmthe chat message to add

◆ load()

void ChatMessage::load ( const rapidjson::Value & document)

Loads data from a document.

Parameters
documentThe document to load from

◆ loadLua()

void ChatMessage::loadLua ( lua_State * state,
const char * namespaceName )
static

Loads the ChatMessage class to a Lua one.

Parameters
statethe state to load to
namespaceNamethe namespace to load to

◆ save()

void ChatMessage::save ( rapidjson::Value & document,
rapidjson::Document::AllocatorType & alloc ) const

Saves data from a document.

Parameters
documentThe document to save to
allocThe allocator of the document

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const ChatMessage & lhs,
const ChatMessage & rhs )
friend

Equality operator between two chat messages.

Parameters
lhsthe left-handside variable
rhsthe righ-handside variable
Returns
true the two variables are equal
false the two variables are not equal

Member Data Documentation

◆ color

std::string ChatMessage::color {}

Color of text.

Should be one of the normal colors, but can also be a format code (however, the fields relating to styles should be used instead for that purpose). If not present (or set to reset), then the default color for the text will be used, which varies by the situation (in some cases, it is white; in others, it is black; in still others, it is a shade of gray that isn't normally used on text).

◆ insertion

std::string ChatMessage::insertion {}

Text to insert.

Only used for messages in chat. When shift is held, clicking the component inserts the given text into the chat box at the cursor (potentially replacing selected text). Has no effect on other locations at this time.

◆ text

std::string ChatMessage::text {}

The text excluding extras.

Does not parse for additional string components, only text.


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