Merge pull request #648 from PrismarineJS/greenkeeper/standard-14.0.0

Update standard to the latest version 🚀
This commit is contained in:
Romain Beaumont 2019-08-21 00:17:24 +02:00 committed by GitHub
commit dc713f0cf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 22 deletions

View file

@ -153,18 +153,18 @@ function parseChat (chatObj, parentState) {
return color(chatObj, getColorize(parentState))
} else {
let chat = ''
if ('color' in chatObj) parentState.color = chatObj['color']
if ('bold' in chatObj) parentState.bold = chatObj['bold']
if ('italic' in chatObj) parentState.italic = chatObj['italic']
if ('underlined' in chatObj) parentState.underlined = chatObj['underlined']
if ('strikethrough' in chatObj) parentState.strikethrough = chatObj['strikethrough']
if ('obfuscated' in chatObj) parentState.obfuscated = chatObj['obfuscated']
if ('color' in chatObj) parentState.color = chatObj.color
if ('bold' in chatObj) parentState.bold = chatObj.bold
if ('italic' in chatObj) parentState.italic = chatObj.italic
if ('underlined' in chatObj) parentState.underlined = chatObj.underlined
if ('strikethrough' in chatObj) parentState.strikethrough = chatObj.strikethrough
if ('obfuscated' in chatObj) parentState.obfuscated = chatObj.obfuscated
if ('text' in chatObj) {
chat += color(chatObj.text, getColorize(parentState))
} else if ('translate' in chatObj && dictionary[chatObj.translate] !== undefined) {
const args = [dictionary[chatObj.translate]]
chatObj['with'].forEach(function (s) {
chatObj.with.forEach(function (s) {
args.push(parseChat(s, parentState))
})

View file

@ -39,7 +39,7 @@
"mocha": "^6.0.0",
"power-assert": "^1.0.0",
"require-self": "^0.2.1",
"standard": "^13.1.0"
"standard": "^14.0.0"
},
"dependencies": {
"buffer-equal": "^1.0.0",

View file

@ -36,12 +36,14 @@ class Client extends EventEmitter {
setSerializer (state) {
this.serializer = createSerializer({ isServer: this.isServer, version: this.version, state: state, customPackets: this.customPackets })
this.deserializer = createDeserializer({ isServer: this.isServer,
this.deserializer = createDeserializer({
isServer: this.isServer,
version: this.version,
state: state,
packetsToParse:
this.packetsToParse,
customPackets: this.customPackets })
customPackets: this.customPackets
})
this.splitter.recognizeLegacyPing = state === states.HANDSHAKING

View file

@ -23,11 +23,11 @@ module.exports = function (client, options) {
const versions = [brandedMinecraftVersion]
.concat(brandedMinecraftVersion.match(/((\d+\.)+\d+)/g) || [])
.map(function (version) {
return minecraftData.versionsByMinecraftVersion['pc'][version]
return minecraftData.versionsByMinecraftVersion.pc[version]
})
.filter(function (info) { return info })
.sort(function (a, b) { return b.version - a.version })
.concat(minecraftData.postNettyVersionsByProtocolVersion['pc'][protocolVersion] || [])
.concat(minecraftData.postNettyVersionsByProtocolVersion.pc[protocolVersion] || [])
if (versions.length === 0) {
client.emit('error', new Error(`unsupported/unknown protocol version: ${protocolVersion}, update minecraft-data`))
}

View file

@ -116,17 +116,17 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
const message = JSON.parse(packet.message)
if (chatCount === 1) {
assert.strictEqual(message.translate, 'chat.type.text')
assert.deepEqual(message['with'][0].clickEvent, {
assert.deepEqual(message.with[0].clickEvent, {
action: 'suggest_command',
value: mcData.version.version > 340 ? '/tell Player ' : '/msg Player '
})
assert.deepEqual(message['with'][0].text, 'Player')
assert.strictEqual(message['with'][1], 'hello everyone; I have logged in.')
assert.deepEqual(message.with[0].text, 'Player')
assert.strictEqual(message.with[1], 'hello everyone; I have logged in.')
} else if (chatCount === 2) {
assert.strictEqual(message.translate, 'chat.type.announcement')
assert.strictEqual(message['with'][0].text ? message['with'][0].text : message['with'][0], 'Server')
assert.deepEqual(message['with'][1].extra ? (message['with'][1].extra[0].text
? message['with'][1].extra[0].text : message['with'][1].extra[0]) : message['with'][1].text, 'hello')
assert.strictEqual(message.with[0].text ? message.with[0].text : message.with[0], 'Server')
assert.deepEqual(message.with[1].extra ? (message.with[1].extra[0].text
? message.with[1].extra[0].text : message.with[1].extra[0]) : message.with[1].text, 'hello')
wrap.removeListener('line', lineListener)
client.end()
done()

View file

@ -9,8 +9,8 @@ const getFieldInfo = require('protodef').utils.getFieldInfo
const getField = require('protodef').utils.getField
function evalCount (count, fields) {
if (fields[count['field']] in count['map']) { return count['map'][fields[count['field']]] }
return count['default']
if (fields[count.field] in count.map) { return count.map[fields[count.field]] }
return count.default
}
const slotValue = {
@ -64,8 +64,8 @@ const values = {
}
Object.keys(typeArgs).forEach(function (index) {
const v = typeArgs[index].name === 'type' && typeArgs[index].type === 'string' && typeArgs[2] !== undefined &&
typeArgs[2]['type'] !== undefined
? (typeArgs[2]['type'][1]['fields']['minecraft:crafting_shapeless'] === undefined ? 'crafting_shapeless' : 'minecraft:crafting_shapeless')
typeArgs[2].type !== undefined
? (typeArgs[2].type[1].fields['minecraft:crafting_shapeless'] === undefined ? 'crafting_shapeless' : 'minecraft:crafting_shapeless')
: getValue(typeArgs[index].type, results)
if (typeArgs[index].anon) {
Object.keys(v).forEach(key => {