Small Bug Fix

This commit is contained in:
TheBrokenRail 2025-02-27 05:26:35 -05:00
parent 71e660575f
commit 955c2b9b3d
4 changed files with 18 additions and 3 deletions

View File

@ -514,7 +514,10 @@ sign->lines[i] = api_get_input(line_##i); \
return CommandServer::NullString;
} else {
// Call Original Method
return old(server, client, command);
api_suppress_chat_events = client.sock >= 0; // Suppress If Real API Client
std::string ret = old(server, client, command);
api_suppress_chat_events = false;
return ret;
}
}

View File

@ -235,9 +235,19 @@ static void Gui_addMessage_injection(Gui_addMessage_t original, Gui *gui, const
recursing = false;
}
}
bool api_suppress_chat_events = false;
static bool enabled = false;
void api_add_chat_event(const Player *sender, const std::string &message) {
if (!enabled || (!sender && api_compat_mode)) {
if (!enabled) {
// Extended API Is Disabled
return;
}
if (!sender && api_compat_mode) {
// Non-Chat Message Are Only Supported In Non-Compatability Mode
return;
}
if (api_suppress_chat_events) {
// Do Not Record Messages Sent By The API
return;
}
push_event(&ExtraClientData::chat_events, {

View File

@ -27,3 +27,5 @@ __attribute__((visibility("internal"))) void api_clear_events(const ConnectedCli
__attribute__((visibility("internal"))) std::string api_get_projectile_events(CommandServer *server, const ConnectedClient &client, std::optional<int> id);
__attribute__((visibility("internal"))) std::string api_get_chat_events(CommandServer *server, const ConnectedClient &client, std::optional<int> id);
__attribute__((visibility("internal"))) std::string api_get_block_hit_events(CommandServer *server, const ConnectedClient &client, std::optional<int> id);
__attribute__((visibility("internal"))) extern bool api_suppress_chat_events;

View File

@ -1,6 +1,6 @@
size 0xc;
property uint sock = 0x0;
property int sock = 0x0;
property std::string str = 0x4;
property int lastBlockHitPoll = 0x8;