mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Chat: new settings to prevent spam
Added the following chat coreside features * Chat messages length limit * Message rate limiting * Message rate kicking Note: * handleChat now takes RemotePlayer pointer instead of u16 to remove useless lookups
This commit is contained in:
parent
1079aeaa13
commit
d4c76258e3
8 changed files with 125 additions and 11 deletions
|
@ -1065,7 +1065,7 @@ void Server::handleCommand_ChatMessage(NetworkPacket* pkt)
|
|||
std::wstring wname = narrow_to_wide(name);
|
||||
|
||||
std::wstring answer_to_sender = handleChat(name, wname, message,
|
||||
true, pkt->getPeerId());
|
||||
true, dynamic_cast<RemotePlayer *>(player));
|
||||
if (!answer_to_sender.empty()) {
|
||||
// Send the answer to sender
|
||||
SendChatMessage(pkt->getPeerId(), answer_to_sender);
|
||||
|
@ -1656,16 +1656,16 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
|
|||
}
|
||||
|
||||
} // action == 4
|
||||
|
||||
|
||||
/*
|
||||
5: rightclick air
|
||||
*/
|
||||
else if (action == 5) {
|
||||
ItemStack item = playersao->getWieldedItem();
|
||||
|
||||
actionstream << player->getName() << " activates "
|
||||
|
||||
actionstream << player->getName() << " activates "
|
||||
<< item.name << std::endl;
|
||||
|
||||
|
||||
if (m_script->item_OnSecondaryUse(
|
||||
item, playersao)) {
|
||||
if( playersao->setWieldedItem(item)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue