yeow-api 0.2.46 → 0.2.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeow-api",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
4
4
  "description": "Yeow API",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/material.ts CHANGED
@@ -9,23 +9,27 @@ export interface MaterialInfo {
9
9
  let _materials: MaterialInfo[] | null = null;
10
10
 
11
11
  export async function getMaterials(): Promise<MaterialInfo[]> {
12
- if (_materials) return structuredClone(_materials);
12
+ if (_materials) return _materials;
13
13
  _materials = await post<MaterialInfo[]>('server.getMaterials', {});
14
- return structuredClone(_materials);
14
+ Object.freeze(_materials);
15
+ for (const m of _materials) Object.freeze(m);
16
+ return _materials;
15
17
  }
16
18
 
17
19
  let _blocks: string[] | null = null;
18
20
 
19
21
  export async function getBlocks(): Promise<string[]> {
20
- if (_blocks) return _blocks.slice();
22
+ if (_blocks) return _blocks;
21
23
  _blocks = await post<string[]>('server.getBlocks', {});
22
- return _blocks.slice();
24
+ Object.freeze(_blocks);
25
+ return _blocks;
23
26
  }
24
27
 
25
28
  let _items: string[] | null = null;
26
29
 
27
30
  export async function getItems(): Promise<string[]> {
28
- if (_items) return _items.slice();
31
+ if (_items) return _items;
29
32
  _items = await post<string[]>('server.getItems', {});
30
- return _items.slice();
33
+ Object.freeze(_items);
34
+ return _items;
31
35
  }
package/src/player.ts CHANGED
@@ -56,6 +56,9 @@ export class Player {
56
56
  get isOp(): boolean { return call<boolean>('player.isOp', { uuid: this.uuid }); }
57
57
  isOpAsync(): Promise<boolean> { return post<boolean>('player.isOp', { uuid: this.uuid }); }
58
58
 
59
+ get online(): boolean { return call<boolean>('player.isOnline', { uuid: this.uuid }); }
60
+ getOnline(): Promise<boolean> { return post<boolean>('player.isOnline', { uuid: this.uuid }); }
61
+
59
62
  get isFlying(): boolean { return call<boolean>('player.isFlying', { uuid: this.uuid }); }
60
63
  set isFlying(v: boolean) { call('player.setFlying', { uuid: this.uuid, value: v }); }
61
64
  isFlyingAsync(): Promise<boolean> { return post<boolean>('player.isFlying', { uuid: this.uuid }); }