baltica 2.0.4 → 2.0.6

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.
@@ -238,6 +238,9 @@ class Client extends utils_1.Emitter {
238
238
  }
239
239
  catch (err) {
240
240
  utils_2.Logger.error("Failed to decompress packet", err);
241
+ if (err instanceof Error && err.message.includes("Checksum mismatch")) {
242
+ this.disconnect("Encryption checksum mismatch: Connection corrupted");
243
+ }
241
244
  }
242
245
  }
243
246
  handlePacket(buffer) {
@@ -24,4 +24,5 @@ export declare class Player extends Emitter<PlayerEvents> {
24
24
  send(packet: Buffer | Buffer[], priority?: Priority, compressionMethod?: CompressionMethod): void;
25
25
  queue(packet: Buffer | Buffer[]): void;
26
26
  sendUncompressed(packet: Buffer, priority?: Priority): void;
27
+ disconnect(reason?: string): void;
27
28
  }
@@ -158,6 +158,9 @@ class Player extends utils_1.Emitter {
158
158
  }
159
159
  catch (err) {
160
160
  utils_1.Logger.error("Failed to decompress packet", err);
161
+ if (err instanceof Error && err.message.includes("Checksum mismatch")) {
162
+ this.disconnect("Encryption checksum mismatch: Connection corrupted");
163
+ }
161
164
  }
162
165
  }
163
166
  handlePacket(buffer) {
@@ -199,5 +202,10 @@ class Player extends utils_1.Emitter {
199
202
  framed.copy(buf, 1);
200
203
  this.connection.send(buf, priority);
201
204
  }
205
+ disconnect(reason = "disconnected") {
206
+ utils_1.Logger.info(`Disconnecting ${this.username || "player"}: ${reason}`);
207
+ this.connection.disconnect();
208
+ this.emit("disconnect");
209
+ }
202
210
  }
203
211
  exports.Player = Player;
@@ -5,5 +5,6 @@ export type PlayerEvents = {
5
5
  } & {
6
6
  packet: [Protocol.DataPacket];
7
7
  login: [];
8
+ disconnect: [];
8
9
  error: [Error];
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baltica",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Core baltica package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,9 +10,9 @@
10
10
  "clean": "rimraf dist"
11
11
  },
12
12
  "dependencies": {
13
- "@baltica/auth": "workspace:*",
14
- "@baltica/raknet": "workspace:*",
15
- "@baltica/utils": "workspace:*",
13
+ "@baltica/auth": "*",
14
+ "@baltica/raknet": "*",
15
+ "@baltica/utils": "*",
16
16
  "@serenityjs/protocol": "^0.8.18",
17
17
  "jose": "^6.1.3"
18
18
  },
@@ -20,6 +20,6 @@
20
20
  "dist"
21
21
  ],
22
22
  "devDependencies": {
23
- "@types/node": "^25.3.0"
23
+ "@types/node": "^25.3.3"
24
24
  }
25
25
  }