mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
Fix client sending chat_session packet before server state transition (#1081)
* Fix client sending session packet when server is in offline mode * Don't send chat session packet before server is in play state * Fix lint --------- Co-authored-by: Frej Alexander Nielsen <frej@valoks.com>
This commit is contained in:
parent
45ea82a7dc
commit
90d4143358
1 changed files with 11 additions and 8 deletions
|
@ -11,15 +11,10 @@ module.exports = function (client, options) {
|
|||
}
|
||||
})
|
||||
|
||||
client.once('success', onLogin)
|
||||
const mcData = require('minecraft-data')(client.version)
|
||||
|
||||
function onLogin (packet) {
|
||||
const mcData = require('minecraft-data')(client.version)
|
||||
client.state = states.PLAY
|
||||
client.uuid = packet.uuid
|
||||
client.username = packet.username
|
||||
|
||||
if (mcData.supportFeature('useChatSessions') && client.profileKeys && client._cipher) {
|
||||
client.once('login', () => {
|
||||
if (mcData.supportFeature('useChatSessions') && client.profileKeys && client.cipher) {
|
||||
client._session = {
|
||||
index: 0,
|
||||
uuid: uuid.v4fast()
|
||||
|
@ -32,6 +27,14 @@ module.exports = function (client, options) {
|
|||
signature: client.profileKeys ? client.profileKeys.signatureV2 : undefined
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
client.once('success', onLogin)
|
||||
|
||||
function onLogin (packet) {
|
||||
client.state = states.PLAY
|
||||
client.uuid = packet.uuid
|
||||
client.username = packet.username
|
||||
|
||||
if (mcData.supportFeature('signedChat')) {
|
||||
if (options.disableChatSigning && client.serverFeatures.enforcesSecureChat) {
|
||||
|
|
Loading…
Reference in a new issue