mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
1.19.3 chat fixes (#1093)
Co-authored-by: Frej Alexander Nielsen <frej@valoks.com>
This commit is contained in:
parent
f52ab55ef9
commit
70aee3d494
1 changed files with 2 additions and 0 deletions
|
@ -46,6 +46,7 @@ module.exports = function (client, options) {
|
|||
if (player && player.hasChainIntegrity) {
|
||||
if (!player.lastSignature || player.lastSignature.equals(currentSignature) || index > player.sessionIndex) {
|
||||
player.lastSignature = currentSignature
|
||||
player.sessionIndex = index
|
||||
} else {
|
||||
player.hasChainIntegrity = false
|
||||
}
|
||||
|
@ -194,6 +195,7 @@ module.exports = function (client, options) {
|
|||
const tsDelta = BigInt(Date.now()) - packet.timestamp
|
||||
const expired = !packet.timestamp || tsDelta > messageExpireTime || tsDelta < 0
|
||||
const verified = !packet.unsignedChatContent && updateAndValidateSession(packet.senderUuid, packet.plainMessage, packet.signature, packet.index, packet.previousMessages, packet.salt, packet.timestamp) && !expired
|
||||
if (verified) client._signatureCache.push(packet.signature)
|
||||
client.emit('playerChat', {
|
||||
plainMessage: packet.plainMessage,
|
||||
unsignedContent: packet.unsignedContent,
|
||||
|
|
Loading…
Reference in a new issue