12#ifndef MINESERVER_CHATMESSAGE_H
13#define MINESERVER_CHATMESSAGE_H
16#include <unordered_map>
17#include <rapidjson/rapidjson.h>
18#include <rapidjson/document.h>
177 void save(rapidjson::Value &
document, rapidjson::Document::AllocatorType &
alloc)
const;
242 void save(rapidjson::Value &
document, rapidjson::Document::AllocatorType &
alloc)
const;
263#ifndef DOXYGEN_IGNORE_THIS
265struct luabridge::Stack<
ChatMessage::ClickEvent::ActionType>
266 : luabridge::Enum<ChatMessage::ClickEvent::ActionType,
267 ChatMessage::ClickEvent::ActionType::NONE,
268 ChatMessage::ClickEvent::ActionType::OPEN_URL,
269 ChatMessage::ClickEvent::ActionType::RUN_COMMAND,
270 ChatMessage::ClickEvent::ActionType::SUGGEST_COMMAND,
271 ChatMessage::ClickEvent::ActionType::CHANGE_PAGE,
272 ChatMessage::ClickEvent::ActionType::COPY_TO_CLIPBOARD>
Click Event.
Definition chatmessage.h:89
ActionType
Type of action to perform.
Definition chatmessage.h:96
@ SUGGEST_COMMAND
Suggest command to user.
Definition chatmessage.h:117
@ CHANGE_PAGE
Change page (book only)
Definition chatmessage.h:122
@ RUN_COMMAND
Run command.
Definition chatmessage.h:112
@ NONE
No action.
Definition chatmessage.h:102
@ OPEN_URL
Open URL.
Definition chatmessage.h:107
@ COPY_TO_CLIPBOARD
Copy text to clipboard.
Definition chatmessage.h:127
void save(rapidjson::Value &document, rapidjson::Document::AllocatorType &alloc) const
Save click event to JSON.
Definition chatmessage.cpp:222
std::string value
Value of action.
Definition chatmessage.h:139
static void loadLua(lua_State *state, const char *namespaceName)
Loads Click Event to lua.
Definition chatmessage.cpp:242
ClickEvent()
Construct a new Click Event object.
Definition chatmessage.cpp:178
ActionType action
Action to perform.
Definition chatmessage.h:134
void load(const rapidjson::Value &document)
Load click event from JSON.
Definition chatmessage.cpp:194
~ClickEvent()=default
Destroy the Click Event object.
Minecraft Chat Message implementation.
Definition chatmessage.h:28
ClickEvent clickEvent
Click event for message.
Definition chatmessage.h:192
ChatMessage()
Construct a new Chat Message object.
friend bool operator==(const ChatMessage &lhs, const ChatMessage &rhs)
Equality operator between two chat messages.
Definition chatmessage.cpp:135
bool italic
Italicness for text.
Definition chatmessage.h:39
std::string text
The text excluding extras.
Definition chatmessage.h:81
void addExtra(ChatMessage *cm)
Adds an extra.
Definition chatmessage.cpp:34
void load(const rapidjson::Value &document)
Loads data from a document.
Definition chatmessage.cpp:51
bool strikethrough
Strikethrough or not text.
Definition chatmessage.h:49
void save(rapidjson::Value &document, rapidjson::Document::AllocatorType &alloc) const
Saves data from a document.
Definition chatmessage.cpp:96
~ChatMessage()
Destroy the Chat Message object.
Definition chatmessage.cpp:26
std::string color
Color of text.
Definition chatmessage.h:64
bool obfuscated
Obfuscate or not text.
Definition chatmessage.h:54
std::string insertion
Text to insert.
Definition chatmessage.h:73
bool bold
Boldness for text.
Definition chatmessage.h:34
static void loadLua(lua_State *state, const char *namespaceName)
Loads the ChatMessage class to a Lua one.
Definition chatmessage.cpp:144
bool underlined
Underline or not text.
Definition chatmessage.h:44
constexpr std::string_view type_name()
Gets the name of the type paramater.
Definition event.h:56