Fix Chat Example Mod
This commit is contained in:
parent
e2c82071c7
commit
be1f3bf50e
@ -5,13 +5,14 @@
|
|||||||
#include <mods/misc/misc.h>
|
#include <mods/misc/misc.h>
|
||||||
|
|
||||||
// The Actual Mod
|
// The Actual Mod
|
||||||
HOOK(chat_handle_packet_send, void, (Minecraft *minecraft, ChatPacket *packet)) {
|
HOOK(chat_handle_packet_send, void, (const Minecraft *minecraft, ChatPacket *packet)) {
|
||||||
// Get Message
|
// Get Message
|
||||||
const char *message = packet->message.c_str();
|
const char *message = packet->message.c_str();
|
||||||
if (message[0] == '/') {
|
if (message[0] == '/') {
|
||||||
// API Command
|
// API Command
|
||||||
Gui *gui = &minecraft->gui;
|
Minecraft *mc = (Minecraft *) minecraft;
|
||||||
std::string out = chat_send_api_command(minecraft, (char *) &message[1]);
|
Gui *gui = &mc->gui;
|
||||||
|
std::string out = chat_send_api_command(mc, (char *) &message[1]);
|
||||||
if (out.length() > 0 && out[out.length() - 1] == '\n') {
|
if (out.length() > 0 && out[out.length() - 1] == '\n') {
|
||||||
out[out.length() - 1] = '\0';
|
out[out.length() - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user