mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Move chat command handling code from C++ to Lua (#5528)
This commit is contained in:
parent
fb4c730708
commit
d4e9dd4643
2 changed files with 19 additions and 21 deletions
|
@ -2820,25 +2820,14 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
|
|||
// Whether to send line to the player that sent the message, or to all players
|
||||
bool broadcast_line = true;
|
||||
|
||||
// Commands are implemented in Lua, so only catch invalid
|
||||
// commands that were not "eaten" and send an error back
|
||||
if (wmessage[0] == L'/') {
|
||||
std::wstring wcmd = wmessage.substr(1);
|
||||
if (check_shout_priv && !checkPriv(name, "shout")) {
|
||||
line += L"-!- You don't have permission to shout.";
|
||||
broadcast_line = false;
|
||||
if (wcmd.length() == 0)
|
||||
line += L"-!- Empty command";
|
||||
else
|
||||
line += L"-!- Invalid command: " + str_split(wcmd, L' ')[0];
|
||||
} else {
|
||||
if (check_shout_priv && !checkPriv(name, "shout")) {
|
||||
line += L"-!- You don't have permission to shout.";
|
||||
broadcast_line = false;
|
||||
} else {
|
||||
line += L"<";
|
||||
line += wname;
|
||||
line += L"> ";
|
||||
line += wmessage;
|
||||
}
|
||||
line += L"<";
|
||||
line += wname;
|
||||
line += L"> ";
|
||||
line += wmessage;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue