Finally Fix Dumb Method Names

This commit is contained in:
TheBrokenRail 2024-11-03 00:02:13 -04:00
parent 419ad9c98c
commit 644e9e421b
4 changed files with 7 additions and 9 deletions

View File

@ -10,6 +10,6 @@ extern "C" {
std::string chat_send_api_command(const Minecraft *minecraft, const std::string &str); std::string chat_send_api_command(const Minecraft *minecraft, const std::string &str);
// Override using the HOOK() macro to provide customized chat behavior. // Override using the HOOK() macro to provide customized chat behavior.
void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, const char *username, const char *message); void chat_send_message_to_clients(ServerSideNetworkHandler *server_side_network_handler, const char *username, const char *message);
void chat_handle_packet_send(const Minecraft *minecraft, ChatPacket *packet); void chat_handle_packet_send(const Minecraft *minecraft, ChatPacket *packet);
} }

View File

@ -9,9 +9,7 @@
// Message Prefix // Message Prefix
__attribute__((visibility("internal"))) std::string _chat_get_prefix(const char *username); __attribute__((visibility("internal"))) std::string _chat_get_prefix(const char *username);
// Queue Message For Sending // Queue Message For Sending
__attribute__((visibility("internal"))) void _chat_send_message(const Minecraft *minecraft, const char *message); __attribute__((visibility("internal"))) void _chat_send_message_to_server(const Minecraft *minecraft, const char *message);
// Init Chat UI // Init Chat UI
__attribute__((visibility("internal"))) void _init_chat_ui(); __attribute__((visibility("internal"))) void _init_chat_ui();

View File

@ -34,7 +34,7 @@ static void send_api_chat_command(const Minecraft *minecraft, const char *str) {
std::string _chat_get_prefix(const char *username) { std::string _chat_get_prefix(const char *username) {
return std::string("<") + username + "> "; return std::string("<") + username + "> ";
} }
void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, const char *username, const char *message) { void chat_send_message_to_clients(ServerSideNetworkHandler *server_side_network_handler, const char *username, const char *message) {
std::string full_message = _chat_get_prefix(username) + message; std::string full_message = _chat_get_prefix(username) + message;
char *raw_str = strdup(full_message.c_str()); char *raw_str = strdup(full_message.c_str());
ALLOC_CHECK(raw_str); ALLOC_CHECK(raw_str);
@ -50,7 +50,7 @@ void chat_handle_packet_send(const Minecraft *minecraft, ChatPacket *packet) {
// Hosting Multiplayer // Hosting Multiplayer
const char *message = packet->message.c_str(); const char *message = packet->message.c_str();
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler; ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler;
chat_send_message(server_side_network_handler, Strings::default_username, (char *) message); chat_send_message_to_clients(server_side_network_handler, Strings::default_username, (char *) message);
} else { } else {
// Client // Client
rak_net_instance->send(*(Packet *) packet); rak_net_instance->send(*(Packet *) packet);
@ -71,12 +71,12 @@ static void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetwo
if (player != nullptr) { if (player != nullptr) {
const char *username = player->username.c_str(); const char *username = player->username.c_str();
const char *message = chat_packet->message.c_str(); const char *message = chat_packet->message.c_str();
chat_send_message(server_side_network_handler, username, message); chat_send_message_to_clients(server_side_network_handler, username, message);
} }
} }
// Send Message // Send Message
void _chat_send_message(const Minecraft *minecraft, const char *message) { void _chat_send_message_to_server(const Minecraft *minecraft, const char *message) {
send_api_chat_command(minecraft, message); send_api_chat_command(minecraft, message);
} }

View File

@ -93,7 +93,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
if (get_history().size() == 0 || text != get_history().back()) { if (get_history().size() == 0 || text != get_history().back()) {
get_history().push_back(text); get_history().push_back(text);
} }
_chat_send_message(super->minecraft, text.c_str()); _chat_send_message_to_server(super->minecraft, text.c_str());
} }
super->minecraft->setScreen(nullptr); super->minecraft->setScreen(nullptr);
} else if (key == MC_KEY_UP) { } else if (key == MC_KEY_UP) {