@minecraft/server-admin 1.0.0-beta.1.26.2-stable → 1.0.0-beta.1.26.20-preview.20
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 +8 -8
- package/index.d.ts +210 -1
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# `@minecraft/server-admin`
|
|
2
|
-
|
|
3
|
-
Contains types related to administering a Bedrock Dedicated Server. These types allow for the configuration of variables and secrets in JSON files in the Bedrock Dedicated Server folder. These types cannot be used on Minecraft clients or within Minecraft Realms.
|
|
4
|
-
|
|
5
|
-
## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
|
|
6
|
-
|
|
7
|
-
See full documentation for this module here:
|
|
8
|
-
|
|
1
|
+
# `@minecraft/server-admin`
|
|
2
|
+
|
|
3
|
+
Contains types related to administering a Bedrock Dedicated Server. These types allow for the configuration of variables and secrets in JSON files in the Bedrock Dedicated Server folder. These types cannot be used on Minecraft clients or within Minecraft Realms.
|
|
4
|
+
|
|
5
|
+
## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
|
|
6
|
+
|
|
7
|
+
See full documentation for this module here:
|
|
8
|
+
|
|
9
9
|
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server-admin/minecraft-server-admin
|
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,33 @@ 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
|
+
|
|
432
|
+
/**
|
|
433
|
+
* An error which is thrown when attempting to kick a player
|
|
434
|
+
* who cannot be kicked.
|
|
435
|
+
*/
|
|
436
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
437
|
+
export class CannotKickPlayerError extends Error {
|
|
438
|
+
private constructor();
|
|
439
|
+
}
|
|
440
|
+
|
|
268
441
|
/**
|
|
269
442
|
* An error that is thrown when trying to interact with a join
|
|
270
443
|
* event and the player is disconnected.
|
|
@@ -279,9 +452,38 @@ export class DisconnectedError extends Error {
|
|
|
279
452
|
* This property can be read in early-execution mode.
|
|
280
453
|
*
|
|
281
454
|
*/
|
|
282
|
-
id: string;
|
|
455
|
+
readonly id: string;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* An error that is thrown when level storage save state
|
|
460
|
+
* management are used out of sequence or are repeated in an
|
|
461
|
+
* invalid way.
|
|
462
|
+
*/
|
|
463
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
464
|
+
export class LevelStorageSaveStateChangeError extends Error {
|
|
465
|
+
private constructor();
|
|
283
466
|
}
|
|
284
467
|
|
|
468
|
+
/**
|
|
469
|
+
* @remarks
|
|
470
|
+
* Kicks a player from the server.
|
|
471
|
+
*
|
|
472
|
+
* This function can't be called in restricted-execution mode.
|
|
473
|
+
*
|
|
474
|
+
* @param player
|
|
475
|
+
* Player to kick.
|
|
476
|
+
* @param reason
|
|
477
|
+
* Reason for kicking the player.
|
|
478
|
+
* @throws This function can throw errors.
|
|
479
|
+
*
|
|
480
|
+
* {@link CannotKickPlayerError}
|
|
481
|
+
*
|
|
482
|
+
* {@link minecraftcommon.EngineError}
|
|
483
|
+
*
|
|
484
|
+
* {@link minecraftcommon.InvalidArgumentError}
|
|
485
|
+
*/
|
|
486
|
+
export function kickPlayer(player: minecraftserver.Player, reason?: string): void;
|
|
285
487
|
/**
|
|
286
488
|
* @remarks
|
|
287
489
|
* Transfer player to another server.
|
|
@@ -299,6 +501,13 @@ export function transferPlayer(
|
|
|
299
501
|
options: TransferPlayerIpPortOptions | TransferPlayerNetherNetOptions,
|
|
300
502
|
): void;
|
|
301
503
|
export const beforeEvents: AdminBeforeEvents;
|
|
504
|
+
/**
|
|
505
|
+
* @remarks
|
|
506
|
+
* A globally available, optional object that contains
|
|
507
|
+
* dedicated-server only apis.
|
|
508
|
+
*
|
|
509
|
+
*/
|
|
510
|
+
export const dedicatedServer: DedicatedServerUtils | undefined;
|
|
302
511
|
/**
|
|
303
512
|
* @remarks
|
|
304
513
|
* A globally available object that returns a list of
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@minecraft/server-admin",
|
|
3
|
-
"version": "1.0.0-beta.1.26.
|
|
4
|
-
"description": "",
|
|
5
|
-
"contributors": [
|
|
6
|
-
{
|
|
7
|
-
"name": "Jake Shirley",
|
|
8
|
-
"email": "jake@xbox.com"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "Mike Ammerlaan",
|
|
12
|
-
"email": "mikeam@microsoft.com"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"@minecraft/common": "^1.0.0",
|
|
17
|
-
"@minecraft/server": "^1.17.0 || ^2.0.0"
|
|
18
|
-
},
|
|
19
|
-
"license": "MIT"
|
|
1
|
+
{
|
|
2
|
+
"name": "@minecraft/server-admin",
|
|
3
|
+
"version": "1.0.0-beta.1.26.20-preview.20",
|
|
4
|
+
"description": "",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Jake Shirley",
|
|
8
|
+
"email": "jake@xbox.com"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Mike Ammerlaan",
|
|
12
|
+
"email": "mikeam@microsoft.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@minecraft/common": "^1.0.0",
|
|
17
|
+
"@minecraft/server": "^1.17.0 || ^2.0.0"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT"
|
|
20
20
|
}
|