send server brand during login

* send server brand to client

* send brand regardless of `0x02` being recieved by server or not

* send brand regardless of `0x02` being recieved by server or not
+ if statement to match previous lines

* ifdef check for brand sending

* commit main.c for ifdef check (i forgot)

* commit main.c for ifdef check (i forgot)

* change sc_pluginMessage to sc_sendPluginMessage

- added params to it for use in other cases
- other changes to fit PR reviews

* revert .gitignore

* revert unrelated changes

* send byte instead of varint for constant packet id

* gate declaration of brand string behind ifdef

* make logging consistent with codebase

---------

Co-authored-by: p2r3 <p2r3@p2r3.com>
This commit is contained in:
Bradlee Barnes
2025-09-13 11:22:06 +00:00
committed by GitHub
parent 2a9e443a8d
commit 969f7d3974
5 changed files with 37 additions and 0 deletions

View File

@@ -157,6 +157,23 @@ int cs_pluginMessage (int client_fd) {
return 0;
}
// S->C Clientbound Plugin Message
int sc_sendPluginMessage (int client_fd, const char *channel, const uint8_t *data, size_t data_len) {
printf("Sending Plugin Message\n\n");
int channel_len = (int)strlen(channel);
writeVarInt(client_fd, 1 + sizeVarInt(channel_len) + channel_len + sizeVarInt(data_len) + data_len);
writeByte(client_fd, 0x01);
writeVarInt(client_fd, channel_len);
send_all(client_fd, channel, channel_len);
writeVarInt(client_fd, data_len);
send_all(client_fd, data, data_len);
return 0;
}
// S->C Finish Configuration
int sc_finishConfiguration (int client_fd) {
writeVarInt(client_fd, 1);