Assume enforce secure chat as false by default

Setting it to true will result in chat validation errors on the client for other players without chat sessions or valid signatures
This commit is contained in:
Nassim Jahnke 2024-04-24 10:26:35 +02:00
parent 9654a613cd
commit d2ca6a82be
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -210,9 +210,15 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
handler(playerTrackerHandler());
handler(wrapper -> {
// Enforces secure chat - moved from server data (which is unfortunately sent a while after this)
// Just put in what we know if this is sent multiple times
final AcknowledgedMessagesStorage storage = wrapper.user().get(AcknowledgedMessagesStorage.class);
wrapper.write(Type.BOOLEAN, storage.isSecureChatEnforced());
if (storage.secureChatEnforced() != null) {
// Just put in what we know if this is sent multiple times
wrapper.write(Type.BOOLEAN, storage.isSecureChatEnforced());
} else {
// Assume that it isn't, otherwise the client will disregard chat messages from players
// without chat sessions if it assumes secure chat is enforced
wrapper.write(Type.BOOLEAN, false);
}
storage.clear();