mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -04:00
fix version checking for lower versions
This commit is contained in:
parent
a55d2bc42c
commit
1e74dc2c1b
@ -2,7 +2,9 @@ module.exports = function(client,options) {
|
||||
client.on("disconnect",message => {
|
||||
if(!message.reason)
|
||||
return;
|
||||
const versionRequired=/Outdated client! Please use (.+)/.exec(JSON.parse(message.reason).text);
|
||||
const parsed=JSON.parse(message.reason);
|
||||
const text=parsed.text ? parsed.text : parsed;
|
||||
const versionRequired=/(?:Outdated client! Please use|Outdated server! I'm still on) (.+)/.exec(text);
|
||||
if(!versionRequired)
|
||||
return;
|
||||
client.emit("error",new Error("This server is version "+versionRequired[1]+
|
||||
|
Loading…
x
Reference in New Issue
Block a user