@minecraft/server-admin 1.0.0-beta.1.26.10-preview.23 → 1.0.0-beta.1.26.10-preview.25

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.
Files changed (2) hide show
  1. package/index.d.ts +181 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -40,6 +40,68 @@ export class AdminBeforeEvents {
40
40
  readonly asyncPlayerJoin: AsyncPlayerJoinBeforeEventSignal;
41
41
  }
42
42
 
43
+ /**
44
+ * Controls the allow list for the server. Only available on
45
+ * dedicated server.
46
+ */
47
+ export class AllowList {
48
+ private constructor();
49
+ /**
50
+ * @remarks
51
+ * This property can't be edited in restricted-execution mode.
52
+ *
53
+ */
54
+ enabled: boolean;
55
+ /**
56
+ * @remarks
57
+ * Adds a player to the server's allow list.
58
+ *
59
+ * @param player
60
+ * Player or player name that should be added to the allow
61
+ * list.
62
+ * @throws This function can throw errors.
63
+ *
64
+ * {@link AllowListModificationError}
65
+ *
66
+ * {@link minecraftserver.InvalidEntityError}
67
+ */
68
+ add(player: minecraftserver.Player | string): void;
69
+ /**
70
+ * @remarks
71
+ * Returns if the player is in the server's allow list.
72
+ *
73
+ * @param player
74
+ * Player or player name that should be checked for.
75
+ * @throws This function can throw errors.
76
+ *
77
+ * {@link minecraftserver.InvalidEntityError}
78
+ */
79
+ contains(player: minecraftserver.Player | string): boolean;
80
+ /**
81
+ * @remarks
82
+ * Reloads the server's allow list from disk.
83
+ *
84
+ * @throws This function can throw errors.
85
+ *
86
+ * {@link AllowListFileReloadError}
87
+ */
88
+ reloadFile(): void;
89
+ /**
90
+ * @remarks
91
+ * Removes a player from the server's allow list.
92
+ *
93
+ * @param player
94
+ * Player or player name that should be removed from the allow
95
+ * list.
96
+ * @throws This function can throw errors.
97
+ *
98
+ * {@link AllowListModificationError}
99
+ *
100
+ * {@link minecraftserver.InvalidEntityError}
101
+ */
102
+ remove(player: minecraftserver.Player | string): void;
103
+ }
104
+
43
105
  /**
44
106
  * The data available before a player joins the world.
45
107
  */
@@ -120,6 +182,90 @@ export class AsyncPlayerJoinBeforeEventSignal {
120
182
  unsubscribe(callback: (arg0: AsyncPlayerJoinBeforeEvent) => Promise<void>): boolean;
121
183
  }
122
184
 
185
+ /**
186
+ * Contains apis that are only available when in Bedrock
187
+ * Dedicated Server.
188
+ */
189
+ export class DedicatedServerUtils {
190
+ private constructor();
191
+ /**
192
+ * @remarks
193
+ * Returns an object that manages the server's allow list.
194
+ *
195
+ */
196
+ readonly allowList: AllowList;
197
+ /**
198
+ * @remarks
199
+ * Returns an object that manages the level's storage.
200
+ *
201
+ */
202
+ readonly levelStorage: LevelStorage;
203
+ /**
204
+ * @remarks
205
+ * Shuts down the dedicated server.
206
+ *
207
+ */
208
+ stopServer(): void;
209
+ }
210
+
211
+ /**
212
+ * Controls how the server saves to disk. Only available on
213
+ * dedicated server.
214
+ */
215
+ export class LevelStorage {
216
+ private constructor();
217
+ /**
218
+ * @remarks
219
+ * Disables the server writing to the world files and begins
220
+ * creating a snapshot.
221
+ *
222
+ * @throws This function can throw errors.
223
+ *
224
+ * {@link LevelStorageSaveStateChangeError}
225
+ */
226
+ saveHold(): void;
227
+ /**
228
+ * @remarks
229
+ * Returns the path and size of every file in the current
230
+ * snapshot if a snapshot is being taken.
231
+ *
232
+ * @throws This function can throw errors.
233
+ *
234
+ * {@link LevelStorageSaveStateChangeError}
235
+ */
236
+ saveQuery(): LevelStorageQuerySnapshotFile[];
237
+ /**
238
+ * @remarks
239
+ * Re-enables server writing world state to files and removes
240
+ * snapshot.
241
+ *
242
+ * @throws This function can throw errors.
243
+ *
244
+ * {@link LevelStorageSaveStateChangeError}
245
+ */
246
+ saveResume(): void;
247
+ }
248
+
249
+ /**
250
+ * Contains information about a file that was gathered during a
251
+ * snapshot.
252
+ */
253
+ export class LevelStorageQuerySnapshotFile {
254
+ private constructor();
255
+ /**
256
+ * @remarks
257
+ * The path to the file in the snapshot.
258
+ *
259
+ */
260
+ readonly fileName: string;
261
+ /**
262
+ * @remarks
263
+ * The size of the file in the snapshot.
264
+ *
265
+ */
266
+ readonly fileSize: number;
267
+ }
268
+
123
269
  /**
124
270
  * This represents a placeholder object that represents a
125
271
  * secret string. The contents of that string are not available
@@ -265,6 +411,24 @@ export interface TransferPlayerNetherNetOptions {
265
411
  netherNetId: string;
266
412
  }
267
413
 
414
+ /**
415
+ * An error that is thrown when the allow list file fails to
416
+ * reload.
417
+ */
418
+ // @ts-ignore Class inheritance allowed for native defined classes
419
+ export class AllowListFileReloadError extends Error {
420
+ private constructor();
421
+ }
422
+
423
+ /**
424
+ * An error which is thrown when modifying the allow list has
425
+ * failed.
426
+ */
427
+ // @ts-ignore Class inheritance allowed for native defined classes
428
+ export class AllowListModificationError extends Error {
429
+ private constructor();
430
+ }
431
+
268
432
  /**
269
433
  * An error that is thrown when trying to interact with a join
270
434
  * event and the player is disconnected.
@@ -282,6 +446,16 @@ export class DisconnectedError extends Error {
282
446
  readonly id: string;
283
447
  }
284
448
 
449
+ /**
450
+ * An error that is thrown when level storage save state
451
+ * management are used out of sequence or are repeated in an
452
+ * invalid way.
453
+ */
454
+ // @ts-ignore Class inheritance allowed for native defined classes
455
+ export class LevelStorageSaveStateChangeError extends Error {
456
+ private constructor();
457
+ }
458
+
285
459
  /**
286
460
  * @remarks
287
461
  * Transfer player to another server.
@@ -299,6 +473,13 @@ export function transferPlayer(
299
473
  options: TransferPlayerIpPortOptions | TransferPlayerNetherNetOptions,
300
474
  ): void;
301
475
  export const beforeEvents: AdminBeforeEvents;
476
+ /**
477
+ * @remarks
478
+ * A globally available, optional object that contains
479
+ * dedicated-server only apis.
480
+ *
481
+ */
482
+ export const dedicatedServer: DedicatedServerUtils | undefined;
302
483
  /**
303
484
  * @remarks
304
485
  * A globally available object that returns a list of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-admin",
3
- "version": "1.0.0-beta.1.26.10-preview.23",
3
+ "version": "1.0.0-beta.1.26.10-preview.25",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {