packet-events-js 1.0.0 → 1.0.1
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.
- package/README.md +358 -14
- package/package.json +2 -3
- package/src/advanced/ConnectionManager.js +486 -0
- package/src/advanced/MiddlewareSystem.js +416 -0
- package/src/advanced/PacketRecorder.js +336 -0
- package/src/advanced/ProtocolAnalyzer.js +396 -0
- package/src/advanced/index.js +32 -0
- package/src/auth/AuthHandler.js +246 -0
- package/src/index.js +3 -1
package/README.md
CHANGED
|
@@ -12,9 +12,15 @@ A robust protocol library for **Minecraft Java Edition** written entirely in **p
|
|
|
12
12
|
- **Encryption** - Complete AES-128-CFB8 encryption support for online mode
|
|
13
13
|
- **Online Mode** - Full Mojang/Microsoft authentication support
|
|
14
14
|
- **Offline Mode** - Offline player UUID generation (version 3)
|
|
15
|
+
- **BungeeCord Forwarding** - Legacy IP forwarding support
|
|
16
|
+
- **Velocity Forwarding** - Modern forwarding with HMAC verification
|
|
15
17
|
- **Complete NBT** - Named Binary Tag read/write
|
|
16
18
|
- **Chat Components** - JSON Text Component with colors, formatting, and events
|
|
17
19
|
- **Multi-version** - Support for Minecraft 1.7.2 to 1.21.11 (66 versions)
|
|
20
|
+
- **Packet Recorder** - Record, export, import, and replay packet streams
|
|
21
|
+
- **Protocol Analyzer** - Deep packet inspection, metrics, and traffic analysis
|
|
22
|
+
- **Middleware System** - Plugin-based packet processing pipeline
|
|
23
|
+
- **Connection Manager** - AutoReconnect, HealthMonitor, ConnectionPool, CircuitBreaker
|
|
18
24
|
|
|
19
25
|
## Requirements
|
|
20
26
|
|
|
@@ -55,8 +61,14 @@ console.log(`Latency: ${status.latency}ms`);
|
|
|
55
61
|
### Connect to Server (Offline Mode)
|
|
56
62
|
|
|
57
63
|
```javascript
|
|
58
|
-
import {
|
|
59
|
-
|
|
64
|
+
import {
|
|
65
|
+
MinecraftClient,
|
|
66
|
+
ProtocolVersion,
|
|
67
|
+
Logger,
|
|
68
|
+
LogLevel,
|
|
69
|
+
KeepAliveClientboundPacket,
|
|
70
|
+
KeepAliveServerboundPacket
|
|
71
|
+
} from 'packet-events-js';
|
|
60
72
|
|
|
61
73
|
Logger.setGlobalLevel(LogLevel.DEBUG);
|
|
62
74
|
|
|
@@ -81,7 +93,7 @@ console.log(`Connected as ${client.playerName}`);
|
|
|
81
93
|
### Encryption API
|
|
82
94
|
|
|
83
95
|
```javascript
|
|
84
|
-
import { MinecraftEncryption, EncryptedConnection } from 'packet-events-js
|
|
96
|
+
import { MinecraftEncryption, EncryptedConnection } from 'packet-events-js';
|
|
85
97
|
|
|
86
98
|
const keyPair = MinecraftEncryption.generateKeyPair();
|
|
87
99
|
console.log('Public Key:', keyPair.publicKey);
|
|
@@ -102,7 +114,7 @@ const serverHash = MinecraftEncryption.computeServerIdHash('', sharedSecret, key
|
|
|
102
114
|
### Auth Handler
|
|
103
115
|
|
|
104
116
|
```javascript
|
|
105
|
-
import { AuthHandler, ClientAuthHandler, AuthMode } from 'packet-events-js
|
|
117
|
+
import { AuthHandler, ClientAuthHandler, AuthMode } from 'packet-events-js';
|
|
106
118
|
|
|
107
119
|
const serverAuth = new AuthHandler({ mode: AuthMode.ONLINE });
|
|
108
120
|
serverAuth.initialize();
|
|
@@ -118,10 +130,57 @@ const clientAuth = new ClientAuthHandler({
|
|
|
118
130
|
});
|
|
119
131
|
```
|
|
120
132
|
|
|
133
|
+
### BungeeCord Forwarding
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import { BungeeCordForwarding, UUID } from 'packet-events-js';
|
|
137
|
+
|
|
138
|
+
const uuid = UUID.randomUUID();
|
|
139
|
+
const handshakeAddress = BungeeCordForwarding.create(
|
|
140
|
+
'play.example.com',
|
|
141
|
+
'192.168.1.100',
|
|
142
|
+
uuid,
|
|
143
|
+
[{ name: 'textures', value: '...' }]
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const result = BungeeCordForwarding.parse(handshakeAddress);
|
|
147
|
+
if (result.success) {
|
|
148
|
+
console.log(`Client IP: ${result.clientIP}`);
|
|
149
|
+
console.log(`UUID: ${result.uuid.toString()}`);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Velocity Modern Forwarding
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
import { VelocityForwarding, AuthHandler, AuthMode, UUID } from 'packet-events-js';
|
|
157
|
+
|
|
158
|
+
const auth = new AuthHandler({
|
|
159
|
+
mode: AuthMode.VELOCITY,
|
|
160
|
+
velocitySecret: 'your-secret-key'
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const result = auth.handleVelocityForwarding(forwardingData);
|
|
164
|
+
if (result.success) {
|
|
165
|
+
console.log(`Player: ${result.username}`);
|
|
166
|
+
console.log(`UUID: ${result.uuid.toString()}`);
|
|
167
|
+
console.log(`IP: ${result.clientIP}`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const uuid = UUID.randomUUID();
|
|
171
|
+
const data = VelocityForwarding.create(
|
|
172
|
+
'your-secret-key',
|
|
173
|
+
'10.0.0.1',
|
|
174
|
+
uuid,
|
|
175
|
+
'PlayerName',
|
|
176
|
+
[{ name: 'textures', value: '...', signature: '...' }]
|
|
177
|
+
);
|
|
178
|
+
```
|
|
179
|
+
|
|
121
180
|
### Intercept Packets
|
|
122
181
|
|
|
123
182
|
```javascript
|
|
124
|
-
import { EventPriority } from 'packet-events-js
|
|
183
|
+
import { EventPriority } from 'packet-events-js';
|
|
125
184
|
|
|
126
185
|
client.packetManager.on('packetSend', (event) => {
|
|
127
186
|
if (event.packet.packetName === 'SetPlayerPosition') {
|
|
@@ -137,10 +196,12 @@ client.packetManager.on('packetSend', (event) => {
|
|
|
137
196
|
### Create Custom Packets
|
|
138
197
|
|
|
139
198
|
```javascript
|
|
140
|
-
import {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
199
|
+
import {
|
|
200
|
+
Packet,
|
|
201
|
+
defaultRegistry,
|
|
202
|
+
ConnectionState,
|
|
203
|
+
PacketDirection
|
|
204
|
+
} from 'packet-events-js';
|
|
144
205
|
|
|
145
206
|
class MyCustomPacket extends Packet {
|
|
146
207
|
static get packetId() { return 0x50; }
|
|
@@ -168,6 +229,263 @@ defaultRegistry.register({
|
|
|
168
229
|
});
|
|
169
230
|
```
|
|
170
231
|
|
|
232
|
+
## Advanced Features
|
|
233
|
+
|
|
234
|
+
### Packet Recorder
|
|
235
|
+
|
|
236
|
+
Record, export, import, and replay complete packet streams:
|
|
237
|
+
|
|
238
|
+
```javascript
|
|
239
|
+
import { PacketRecorder, PacketReplayer, PacketRecord } from 'packet-events-js';
|
|
240
|
+
|
|
241
|
+
const recorder = new PacketRecorder({
|
|
242
|
+
includeRaw: true,
|
|
243
|
+
maxRecords: 10000,
|
|
244
|
+
filter: (packet) => true
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
recorder.start();
|
|
248
|
+
|
|
249
|
+
client.packetManager.on('packetReceive', (event) => {
|
|
250
|
+
recorder.record(event.packet, 'CLIENTBOUND', 'PLAY', event.rawData);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const stats = recorder.getStats();
|
|
254
|
+
console.log(`Recorded: ${stats.totalPackets} packets, ${stats.totalBytes} bytes`);
|
|
255
|
+
console.log(`Duration: ${stats.duration}ms`);
|
|
256
|
+
console.log(`Packets by type:`, stats.packetsByType);
|
|
257
|
+
|
|
258
|
+
const exported = recorder.export();
|
|
259
|
+
const json = JSON.stringify(exported, null, 2);
|
|
260
|
+
|
|
261
|
+
const imported = recorder.import(JSON.parse(json));
|
|
262
|
+
|
|
263
|
+
const replayer = new PacketReplayer(recorder.records, {
|
|
264
|
+
speed: 1.0,
|
|
265
|
+
loop: false,
|
|
266
|
+
onPacket: (record) => {
|
|
267
|
+
console.log(`Replaying: ${record.packetName}`);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
await replayer.start();
|
|
272
|
+
replayer.pause();
|
|
273
|
+
replayer.resume();
|
|
274
|
+
replayer.stop();
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Protocol Analyzer
|
|
278
|
+
|
|
279
|
+
Deep protocol analysis with metrics and traffic visualization:
|
|
280
|
+
|
|
281
|
+
```javascript
|
|
282
|
+
import { ProtocolAnalyzer, ProtocolMetrics, PacketInspector } from 'packet-events-js';
|
|
283
|
+
|
|
284
|
+
const analyzer = new ProtocolAnalyzer({
|
|
285
|
+
trackHistory: true,
|
|
286
|
+
historySize: 1000,
|
|
287
|
+
alertThresholds: {
|
|
288
|
+
latency: 500,
|
|
289
|
+
packetLoss: 0.1,
|
|
290
|
+
throughputMin: 1000
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
analyzer.on('alert', (alert) => {
|
|
295
|
+
console.log(`Alert: ${alert.type} - ${alert.message}`);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
analyzer.start();
|
|
299
|
+
|
|
300
|
+
client.packetManager.on('packetReceive', (event) => {
|
|
301
|
+
analyzer.analyzePacket(event.packet, 'CLIENTBOUND', 'PLAY', event.rawData);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
analyzer.recordLatency(50);
|
|
305
|
+
|
|
306
|
+
const report = analyzer.getReport();
|
|
307
|
+
console.log(`Packets: ${report.packets.total}`);
|
|
308
|
+
console.log(`Bytes: ${report.bytes.total}`);
|
|
309
|
+
console.log(`Avg Latency: ${report.latency.average}ms`);
|
|
310
|
+
|
|
311
|
+
const graph = analyzer.getTrafficGraph();
|
|
312
|
+
console.log(graph);
|
|
313
|
+
|
|
314
|
+
const metrics = new ProtocolMetrics();
|
|
315
|
+
metrics.recordLatency(100);
|
|
316
|
+
metrics.recordPacketLoss(1, 100);
|
|
317
|
+
console.log(`Avg Latency: ${metrics.getAverageLatency()}ms`);
|
|
318
|
+
console.log(`Packet Loss: ${metrics.getPacketLoss() * 100}%`);
|
|
319
|
+
|
|
320
|
+
const inspector = new PacketInspector();
|
|
321
|
+
|
|
322
|
+
const hexDump = inspector.hexDump(packetBuffer);
|
|
323
|
+
console.log(hexDump);
|
|
324
|
+
|
|
325
|
+
const structure = inspector.analyzeStructure(packet);
|
|
326
|
+
console.log(structure);
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Middleware System
|
|
330
|
+
|
|
331
|
+
Plugin-based packet processing pipeline with built-in middleware:
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
import {
|
|
335
|
+
MiddlewarePipeline,
|
|
336
|
+
LoggingMiddleware,
|
|
337
|
+
RateLimitMiddleware,
|
|
338
|
+
ValidationMiddleware,
|
|
339
|
+
TransformMiddleware,
|
|
340
|
+
CacheMiddleware,
|
|
341
|
+
MetricsMiddleware
|
|
342
|
+
} from 'packet-events-js';
|
|
343
|
+
|
|
344
|
+
const pipeline = new MiddlewarePipeline();
|
|
345
|
+
|
|
346
|
+
pipeline.use(new LoggingMiddleware({
|
|
347
|
+
logLevel: 'debug',
|
|
348
|
+
includePayload: true,
|
|
349
|
+
filter: (ctx) => ctx.packet.constructor.packetName !== 'KeepAlive'
|
|
350
|
+
}));
|
|
351
|
+
|
|
352
|
+
pipeline.use(new RateLimitMiddleware({
|
|
353
|
+
maxPackets: 100,
|
|
354
|
+
windowMs: 1000,
|
|
355
|
+
onLimit: (ctx) => console.log('Rate limited!')
|
|
356
|
+
}));
|
|
357
|
+
|
|
358
|
+
pipeline.use(new ValidationMiddleware({
|
|
359
|
+
rules: {
|
|
360
|
+
'ChatMessage': (packet) => packet.message.length <= 256,
|
|
361
|
+
'SetPlayerPosition': (packet) => Math.abs(packet.y) < 320
|
|
362
|
+
},
|
|
363
|
+
onInvalid: (ctx, rule) => console.log(`Invalid: ${rule}`)
|
|
364
|
+
}));
|
|
365
|
+
|
|
366
|
+
pipeline.use(new TransformMiddleware({
|
|
367
|
+
transforms: {
|
|
368
|
+
'ChatMessage': (packet) => {
|
|
369
|
+
packet.message = packet.message.trim();
|
|
370
|
+
return packet;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}));
|
|
374
|
+
|
|
375
|
+
const metricsMiddleware = new MetricsMiddleware();
|
|
376
|
+
pipeline.use(metricsMiddleware);
|
|
377
|
+
|
|
378
|
+
pipeline.use(async (ctx, next) => {
|
|
379
|
+
console.log(`Before: ${ctx.packet.constructor.packetName}`);
|
|
380
|
+
await next();
|
|
381
|
+
console.log(`After: processing time ${ctx.processingTime}ms`);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
client.packetManager.on('packetReceive', async (event) => {
|
|
385
|
+
const ctx = await pipeline.process({
|
|
386
|
+
packet: event.packet,
|
|
387
|
+
direction: 'CLIENTBOUND',
|
|
388
|
+
state: 'PLAY'
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
if (ctx.cancelled) {
|
|
392
|
+
event.cancel();
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
const metrics = metricsMiddleware.getMetrics();
|
|
397
|
+
console.log(`Processed: ${metrics.processed} packets`);
|
|
398
|
+
console.log(`Blocked: ${metrics.blocked} packets`);
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Connection Manager
|
|
402
|
+
|
|
403
|
+
Advanced connection management with auto-reconnect, health monitoring, and connection pooling:
|
|
404
|
+
|
|
405
|
+
```javascript
|
|
406
|
+
import {
|
|
407
|
+
AutoReconnect,
|
|
408
|
+
ReconnectStrategy,
|
|
409
|
+
HealthMonitor,
|
|
410
|
+
HealthStatus,
|
|
411
|
+
ConnectionPool,
|
|
412
|
+
CircuitBreaker
|
|
413
|
+
} from 'packet-events-js';
|
|
414
|
+
|
|
415
|
+
const reconnect = new AutoReconnect({
|
|
416
|
+
strategy: ReconnectStrategy.EXPONENTIAL,
|
|
417
|
+
baseDelay: 1000,
|
|
418
|
+
maxDelay: 30000,
|
|
419
|
+
maxAttempts: 10,
|
|
420
|
+
jitter: true,
|
|
421
|
+
onReconnect: (attempt) => console.log(`Reconnecting... attempt ${attempt}`),
|
|
422
|
+
onMaxAttempts: () => console.log('Max reconnect attempts reached'),
|
|
423
|
+
onSuccess: () => console.log('Reconnected!')
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
client.on('disconnect', async () => {
|
|
427
|
+
await reconnect.attempt(async () => {
|
|
428
|
+
await client.connect();
|
|
429
|
+
await client.login();
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
const healthMonitor = new HealthMonitor({
|
|
434
|
+
latencyThreshold: 200,
|
|
435
|
+
packetLossThreshold: 0.05,
|
|
436
|
+
checkInterval: 5000
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
healthMonitor.on('statusChange', (status, previousStatus) => {
|
|
440
|
+
console.log(`Health: ${previousStatus} -> ${status}`);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
healthMonitor.on('alert', (alert) => {
|
|
444
|
+
console.log(`${alert.type}: ${alert.message}`);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
client.packetManager.on('packetReceive', (event) => {
|
|
448
|
+
if (event.packet.constructor.packetName === 'KeepAliveClientbound') {
|
|
449
|
+
healthMonitor.recordLatency(Date.now() - event.timestamp);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
const pool = new ConnectionPool({
|
|
454
|
+
minConnections: 2,
|
|
455
|
+
maxConnections: 10,
|
|
456
|
+
strategy: 'least-loaded',
|
|
457
|
+
healthCheck: async (conn) => conn.isConnected,
|
|
458
|
+
healthCheckInterval: 30000
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
await pool.add('lobby', createClient('lobby.server.com'));
|
|
462
|
+
await pool.add('game1', createClient('game1.server.com'));
|
|
463
|
+
await pool.add('game2', createClient('game2.server.com'));
|
|
464
|
+
|
|
465
|
+
const { id, connection } = pool.get();
|
|
466
|
+
await connection.sendPacket(packet);
|
|
467
|
+
pool.release(id);
|
|
468
|
+
|
|
469
|
+
const breaker = new CircuitBreaker({
|
|
470
|
+
failureThreshold: 5,
|
|
471
|
+
successThreshold: 3,
|
|
472
|
+
timeout: 30000,
|
|
473
|
+
onOpen: () => console.log('Circuit OPEN - requests blocked'),
|
|
474
|
+
onClose: () => console.log('Circuit CLOSED - requests allowed'),
|
|
475
|
+
onHalfOpen: () => console.log('Circuit HALF-OPEN - testing')
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
try {
|
|
479
|
+
await breaker.execute(async () => {
|
|
480
|
+
await client.sendPacket(packet);
|
|
481
|
+
});
|
|
482
|
+
} catch (error) {
|
|
483
|
+
if (breaker.isOpen) {
|
|
484
|
+
console.log('Circuit is open, request blocked');
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
171
489
|
## Project Structure
|
|
172
490
|
|
|
173
491
|
```
|
|
@@ -203,10 +521,27 @@ PacketEvents-JS/
|
|
|
203
521
|
│ │ ├── status/
|
|
204
522
|
│ │ ├── login/
|
|
205
523
|
│ │ └── play/
|
|
524
|
+
│ ├── advanced/
|
|
525
|
+
│ │ ├── PacketRecorder.js
|
|
526
|
+
│ │ ├── ProtocolAnalyzer.js
|
|
527
|
+
│ │ ├── MiddlewareSystem.js
|
|
528
|
+
│ │ └── ConnectionManager.js
|
|
206
529
|
│ └── utils/
|
|
207
530
|
│ ├── PacketBuffer.js
|
|
208
531
|
│ └── Logger.js
|
|
209
532
|
└── examples/
|
|
533
|
+
├── authentication.js
|
|
534
|
+
├── basic-client.js
|
|
535
|
+
├── connection-flows.js
|
|
536
|
+
├── custom-packets.js
|
|
537
|
+
├── data-types.js
|
|
538
|
+
├── encryption.js
|
|
539
|
+
├── event-system.js
|
|
540
|
+
├── packet-buffer.js
|
|
541
|
+
├── packet-interception.js
|
|
542
|
+
├── packet-types.js
|
|
543
|
+
├── protocol-versions.js
|
|
544
|
+
└── server-ping.js
|
|
210
545
|
```
|
|
211
546
|
|
|
212
547
|
## Main API
|
|
@@ -240,7 +575,7 @@ client.playerName;
|
|
|
240
575
|
### PacketBuffer
|
|
241
576
|
|
|
242
577
|
```javascript
|
|
243
|
-
import { PacketBuffer } from 'packet-events-js
|
|
578
|
+
import { PacketBuffer } from 'packet-events-js';
|
|
244
579
|
|
|
245
580
|
const buffer = PacketBuffer.writer();
|
|
246
581
|
|
|
@@ -268,7 +603,7 @@ const str = reader.readString();
|
|
|
268
603
|
### MinecraftEncryption
|
|
269
604
|
|
|
270
605
|
```javascript
|
|
271
|
-
import { MinecraftEncryption, EncryptedConnection } from 'packet-events-js
|
|
606
|
+
import { MinecraftEncryption, EncryptedConnection } from 'packet-events-js';
|
|
272
607
|
|
|
273
608
|
const keyPair = MinecraftEncryption.generateKeyPair();
|
|
274
609
|
|
|
@@ -292,7 +627,7 @@ const decrypted = conn.decrypt(data);
|
|
|
292
627
|
### AuthHandler
|
|
293
628
|
|
|
294
629
|
```javascript
|
|
295
|
-
import { AuthHandler, ClientAuthHandler, AuthMode } from 'packet-events-js
|
|
630
|
+
import { AuthHandler, ClientAuthHandler, AuthMode, BungeeCordForwarding, VelocityForwarding } from 'packet-events-js';
|
|
296
631
|
|
|
297
632
|
AuthMode.ONLINE;
|
|
298
633
|
AuthMode.OFFLINE;
|
|
@@ -304,12 +639,21 @@ handler.initialize();
|
|
|
304
639
|
handler.getPublicKey();
|
|
305
640
|
handler.generateVerifyToken();
|
|
306
641
|
handler.generateOfflineUUID(username);
|
|
642
|
+
|
|
643
|
+
const bungeAuth = new AuthHandler({ mode: AuthMode.BUNGEECORD });
|
|
644
|
+
const result = bungeAuth.handleBungeeCordForwarding(serverAddress);
|
|
645
|
+
|
|
646
|
+
const velocityAuth = new AuthHandler({
|
|
647
|
+
mode: AuthMode.VELOCITY,
|
|
648
|
+
velocitySecret: 'your-secret'
|
|
649
|
+
});
|
|
650
|
+
const result2 = velocityAuth.handleVelocityForwarding(loginPluginData);
|
|
307
651
|
```
|
|
308
652
|
|
|
309
653
|
### EventEmitter
|
|
310
654
|
|
|
311
655
|
```javascript
|
|
312
|
-
import { EventPriority } from 'packet-events-js
|
|
656
|
+
import { EventPriority } from 'packet-events-js';
|
|
313
657
|
|
|
314
658
|
EventPriority.LOWEST;
|
|
315
659
|
EventPriority.LOW;
|
|
@@ -330,7 +674,7 @@ await emitter.emitAsync('event', data);
|
|
|
330
674
|
### TextComponent
|
|
331
675
|
|
|
332
676
|
```javascript
|
|
333
|
-
import { TextComponent, ChatColor } from 'packet-events-js
|
|
677
|
+
import { TextComponent, ChatColor } from 'packet-events-js';
|
|
334
678
|
|
|
335
679
|
const message = TextComponent.text('Hello!')
|
|
336
680
|
.color(ChatColor.GREEN)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "packet-events-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A protocol library for Minecraft Java Edition in pure JavaScript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "node src/index.js",
|
|
12
|
-
"example": "node examples/basic-client.js"
|
|
13
|
-
"test": "node examples/packet-types.js && node examples/data-types.js && node examples/encryption.js"
|
|
12
|
+
"example": "node examples/basic-client.js"
|
|
14
13
|
},
|
|
15
14
|
"keywords": [
|
|
16
15
|
"minecraft",
|