mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
add protocolValidation field to server and client options (#964)
* add protocolValidation field to server and client options * add doc * change option name
This commit is contained in:
parent
ef7d0332d9
commit
f7ef27dd70
3 changed files with 6 additions and 2 deletions
|
@ -26,7 +26,8 @@ automatically logged in and validated against mojang's auth.
|
|||
* errorHandler : A way to override the default error handler for client errors. A function that takes a Client and an error.
|
||||
The default kicks the client.
|
||||
* hideErrors : do not display errors, default to false
|
||||
* agent : a http agent that can be used to set proxy settings for yggdrasil authentication confirmation (see proxy-agent on npm)
|
||||
* agent : a http agent that can be used to set proxy settings for yggdrasil authentication confirmation (see proxy-agent on npm)
|
||||
* validateChannelProtocol (optional) : whether or not to enable protocol validation for custom protocols using plugin channels for the connected clients. Defaults to true
|
||||
|
||||
## mc.Server(version,[customPackets])
|
||||
|
||||
|
@ -116,6 +117,7 @@ Returns a `Client` instance and perform login.
|
|||
* onMsaCode(data) : (optional) callback called when signing in with a microsoft account
|
||||
with device code auth. `data` is an object documented [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code#device-authorization-response)
|
||||
* id : a numeric client id used for referring to multiple clients in a server
|
||||
* validateChannelProtocol (optional) : whether or not to enable protocol validation for custom protocols using plugin channels. Defaults to true
|
||||
|
||||
|
||||
## mc.Client(isServer,version,[customPackets])
|
||||
|
|
|
@ -5,7 +5,7 @@ const debug = require('debug')('minecraft-protocol')
|
|||
module.exports = function (client, options) {
|
||||
const mcdata = require('minecraft-data')(options.version || require('../version').defaultVersion)
|
||||
const channels = []
|
||||
const proto = new ProtoDef()
|
||||
const proto = new ProtoDef(options.validateChannelProtocol ?? true)
|
||||
proto.addTypes(mcdata.protocol.types)
|
||||
proto.addTypes(minecraft)
|
||||
proto.addType('registerarr', [readDumbArr, writeDumbArr, sizeOfDumbArr])
|
||||
|
|
2
src/index.d.ts
vendored
2
src/index.d.ts
vendored
|
@ -104,6 +104,7 @@ declare module 'minecraft-protocol' {
|
|||
onMsaCode?: (data: MicrosoftDeviceAuthorizationResponse) => void
|
||||
id?: number
|
||||
session?: SessionOption
|
||||
validateChannelProtocol?: boolean
|
||||
}
|
||||
|
||||
export class Server extends EventEmitter {
|
||||
|
@ -147,6 +148,7 @@ declare module 'minecraft-protocol' {
|
|||
errorHandler?: (client: Client, error: Error) => void
|
||||
hideErrors?: boolean
|
||||
agent?: Agent
|
||||
validateChannelProtocol: boolean
|
||||
}
|
||||
|
||||
export interface SerializerOptions {
|
||||
|
|
Loading…
Reference in a new issue