prismarine-proxy 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,13 +13,20 @@ jobs:
13
13
  - name: Set up Node.js
14
14
  uses: actions/setup-node@master
15
15
  with:
16
- node-version: 10.0.0
17
- - name: Publish if version has been updated
18
- uses: pascalgn/npm-publish-action@4f4bf159e299f65d21cd1cbd96fc5d53228036df
19
- with: # All of theses inputs are optional
20
- tag_name: "%s"
21
- tag_message: "%s"
22
- commit_pattern: "^Release (\\S+)"
23
- env: # More info about the environment variables in the README
24
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated
25
- NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings
16
+ node-version: 14.0.0
17
+ - id: publish
18
+ uses: JS-DevTools/npm-publish@v1
19
+ with:
20
+ token: ${{ secrets.NPM_AUTH_TOKEN }}
21
+ - name: Create Release
22
+ if: steps.publish.outputs.type != 'none'
23
+ id: create_release
24
+ uses: actions/create-release@v1
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27
+ with:
28
+ tag_name: ${{ steps.publish.outputs.version }}
29
+ release_name: Release ${{ steps.publish.outputs.version }}
30
+ body: ${{ steps.publish.outputs.version }}
31
+ draft: false
32
+ prerelease: false
package/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## History
2
2
 
3
+ ### 1.1.3
4
+
5
+ - Use minecraft-data's login packet if one is not in minecraft-packets
6
+
3
7
  ### 1.1.2
4
8
 
5
9
  - Update mcdata
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-proxy",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Provide features to build proxies using Prismarine modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "homepage": "https://github.com/PrismarineJS/prismarine-proxy#readme",
26
26
  "devDependencies": {
27
- "mocha": "^9.1.3",
27
+ "mocha": "^10.0.0",
28
28
  "prismarine-proxy": "file:.",
29
- "standard": "^16.0.1"
29
+ "standard": "^17.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "debug": "^4.3.1",
@@ -7,11 +7,16 @@ const verMap = {
7
7
  '1.8.8': '1.8',
8
8
  '1.8.9': '1.8'
9
9
  }
10
- function getPacket (ver, name) {
11
- if (!packets[ver]) throw new Error(`Packets for version ${ver} aren't stored. This can be fixed by dumping them adding them to the verMap if similar packets are stored.`)
12
- const packet = packets[ver]['from-server'][name][0].json
10
+
11
+ function getPacket (ver, name, mcData) {
12
+ let packet = packets[ver]?.['from-server']?.[name][0].json
13
+ if (name === 'login') {
14
+ packet = packet ?? mcData.loginPacket
15
+ }
16
+ if (!packet) throw new Error(`Packets for version ${ver} aren't stored. This can be fixed by dumping them adding them to the verMap if similar packets are stored.`)
13
17
  return packet
14
18
  }
19
+
15
20
  class InstantConnectProxy extends EventEmitter {
16
21
  constructor (options) {
17
22
  super()
@@ -30,7 +35,7 @@ class InstantConnectProxy extends EventEmitter {
30
35
  const mcData = mcDataLoader(toClient.version)
31
36
  const mcVersion = mcData.version.minecraftVersion
32
37
  const ver = verMap[mcVersion] ?? mcVersion
33
- toClient.write('login', { ...getPacket(ver, 'login'), entityId: toClient.id })
38
+ toClient.write('login', { ...getPacket(ver, 'login', mcData), entityId: toClient.id })
34
39
 
35
40
  const toServer = createClient({
36
41
  ...this.options.clientOptions,
@@ -72,6 +77,7 @@ class InstantConnectProxy extends EventEmitter {
72
77
  this.emit('incoming', data, meta, toClient, toServer)
73
78
  }
74
79
  })
80
+
75
81
  toClient.once('end', () => {
76
82
  this.emit('end', toServer.username)
77
83
  this.endClient(toClient)