@minecraft/server-admin 1.0.0-beta.1.26.20-preview.20 → 1.0.0-beta.1.26.20-preview.22

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 +105 -26
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -200,6 +200,33 @@ export class DedicatedServerUtils {
200
200
  *
201
201
  */
202
202
  readonly levelStorage: LevelStorage;
203
+ /**
204
+ * @remarks
205
+ * Reloads the cdn configuration from disk.
206
+ *
207
+ * @throws This function can throw errors.
208
+ *
209
+ * {@link minecraftcommon.EngineError}
210
+ */
211
+ reloadCDNConfig(): void;
212
+ /**
213
+ * @remarks
214
+ * Reloads the permissions for the server from disk.
215
+ *
216
+ * @throws This function can throw errors.
217
+ *
218
+ * {@link minecraftcommon.EngineError}
219
+ */
220
+ reloadPermissions(): void;
221
+ /**
222
+ * @remarks
223
+ * Reloads the script configuration for the server from disk.
224
+ *
225
+ * @throws This function can throw errors.
226
+ *
227
+ * {@link minecraftcommon.EngineError}
228
+ */
229
+ reloadScriptingConfig(): void;
203
230
  /**
204
231
  * @remarks
205
232
  * Shuts down the dedicated server.
@@ -280,28 +307,28 @@ export class SecretString {
280
307
  * configuration.
281
308
  * @example getPlayerProfile.ts
282
309
  * ```typescript
283
- * import { variables, secrets } from "@minecraft/server-admin";
284
- * import { http, HttpRequest, HttpRequestMethod, HttpHeader, HttpResponse } from "@minecraft/server-net";
310
+ * import { variables, secrets } from '@minecraft/server-admin';
311
+ * import { http, HttpRequest, HttpRequestMethod, HttpHeader, HttpResponse } from '@minecraft/server-net';
285
312
  *
286
313
  * const serverUrl = variables.get('serverEndpoint');
287
314
  *
288
315
  * function getPlayerProfile(playerId: string): Promise<HttpResponse> {
289
- * const req = new HttpRequest(serverUrl + 'getPlayerProfile');
316
+ * const req = new HttpRequest(serverUrl + 'getPlayerProfile');
290
317
  *
291
- * req.body = JSON.stringify({
292
- * playerId,
293
- * });
318
+ * req.body = JSON.stringify({
319
+ * playerId,
320
+ * });
294
321
  *
295
- * const authTokenSec = secrets.get('authtoken');
322
+ * const authTokenSec = secrets.get('authtoken');
296
323
  *
297
- * if (!authTokenSec) {
298
- * throw new Error('authtoken secret not defined.');
299
- * }
324
+ * if (!authTokenSec) {
325
+ * throw new Error('authtoken secret not defined.');
326
+ * }
300
327
  *
301
- * req.method = HttpRequestMethod.Post;
302
- * req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];
328
+ * req.method = HttpRequestMethod.Post;
329
+ * req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];
303
330
  *
304
- * return http.request(req);
331
+ * return http.request(req);
305
332
  * }
306
333
  * ```
307
334
  */
@@ -333,28 +360,28 @@ export class ServerSecrets {
333
360
  * configuration.
334
361
  * @example getPlayerProfile.ts
335
362
  * ```typescript
336
- * import { variables, secrets } from "@minecraft/server-admin";
337
- * import { http, HttpRequest, HttpRequestMethod, HttpHeader, HttpResponse } from "@minecraft/server-net";
363
+ * import { variables, secrets } from '@minecraft/server-admin';
364
+ * import { http, HttpRequest, HttpRequestMethod, HttpHeader, HttpResponse } from '@minecraft/server-net';
338
365
  *
339
366
  * const serverUrl = variables.get('serverEndpoint');
340
367
  *
341
368
  * function getPlayerProfile(playerId: string): Promise<HttpResponse> {
342
- * const req = new HttpRequest(serverUrl + 'getPlayerProfile');
369
+ * const req = new HttpRequest(serverUrl + 'getPlayerProfile');
343
370
  *
344
- * req.body = JSON.stringify({
345
- * playerId,
346
- * });
371
+ * req.body = JSON.stringify({
372
+ * playerId,
373
+ * });
347
374
  *
348
- * const authTokenSec = secrets.get('authtoken');
375
+ * const authTokenSec = secrets.get('authtoken');
349
376
  *
350
- * if (!authTokenSec) {
351
- * throw new Error('authtoken secret not defined.');
352
- * }
377
+ * if (!authTokenSec) {
378
+ * throw new Error('authtoken secret not defined.');
379
+ * }
353
380
  *
354
- * req.method = HttpRequestMethod.Post;
355
- * req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];
381
+ * req.method = HttpRequestMethod.Post;
382
+ * req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];
356
383
  *
357
- * return http.request(req);
384
+ * return http.request(req);
358
385
  * }
359
386
  * ```
360
387
  */
@@ -429,6 +456,15 @@ export class AllowListModificationError extends Error {
429
456
  private constructor();
430
457
  }
431
458
 
459
+ /**
460
+ * An error which is thrown when attempting to deop a player
461
+ * which cannot have their permissions removed.
462
+ */
463
+ // @ts-ignore Class inheritance allowed for native defined classes
464
+ export class CannotDeopPlayerError extends Error {
465
+ private constructor();
466
+ }
467
+
432
468
  /**
433
469
  * An error which is thrown when attempting to kick a player
434
470
  * who cannot be kicked.
@@ -465,6 +501,32 @@ export class LevelStorageSaveStateChangeError extends Error {
465
501
  private constructor();
466
502
  }
467
503
 
504
+ /**
505
+ * An error which is thrown when attempting to op a player that
506
+ * already has op permissions.
507
+ */
508
+ // @ts-ignore Class inheritance allowed for native defined classes
509
+ export class PlayerAlreadyOpError extends Error {
510
+ private constructor();
511
+ }
512
+
513
+ /**
514
+ * @remarks
515
+ * Removes the player's op permissions.
516
+ *
517
+ * This function can't be called in restricted-execution mode.
518
+ *
519
+ * @param player
520
+ * Player to remove permissions from.
521
+ * @throws This function can throw errors.
522
+ *
523
+ * {@link CannotDeopPlayerError}
524
+ *
525
+ * {@link minecraftcommon.EngineError}
526
+ *
527
+ * {@link minecraftcommon.InvalidArgumentError}
528
+ */
529
+ export function deopPlayer(player: minecraftserver.Player): void;
468
530
  /**
469
531
  * @remarks
470
532
  * Kicks a player from the server.
@@ -484,6 +546,23 @@ export class LevelStorageSaveStateChangeError extends Error {
484
546
  * {@link minecraftcommon.InvalidArgumentError}
485
547
  */
486
548
  export function kickPlayer(player: minecraftserver.Player, reason?: string): void;
549
+ /**
550
+ * @remarks
551
+ * Gives the player op permissions.
552
+ *
553
+ * This function can't be called in restricted-execution mode.
554
+ *
555
+ * @param player
556
+ * Player to add permissions to.
557
+ * @throws This function can throw errors.
558
+ *
559
+ * {@link minecraftcommon.EngineError}
560
+ *
561
+ * {@link minecraftcommon.InvalidArgumentError}
562
+ *
563
+ * {@link PlayerAlreadyOpError}
564
+ */
565
+ export function opPlayer(player: minecraftserver.Player): void;
487
566
  /**
488
567
  * @remarks
489
568
  * Transfer player to another server.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-admin",
3
- "version": "1.0.0-beta.1.26.20-preview.20",
3
+ "version": "1.0.0-beta.1.26.20-preview.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {