@jsprismarine/prismarine
Version:
Dedicated Minecraft Bedrock Edition server written in TypeScript
79 lines • 2.79 kB
TypeScript
import { Player, Server, Service } from '../';
/**
* Permission manager.
*/
export declare class PermissionManager implements Service {
private readonly server;
private readonly ops;
private readonly permissions;
private defaultPermissions;
private defaultOperatorPermissions;
/**
* Create a new permission manager.
* @param {Server} server - The server instance.
*/
constructor(server: Server);
/**
* Enable the manager and load all permissions.
* @returns {Promise<void>} A promise that resolves when the manager is enabled.
* @group Lifecycle
*/
enable(): Promise<void>;
/**
* Signifies that the manager is being disabled and all permissions should be unloaded.
* @returns {Promise<void>} A promise that resolves when the manager is disabled.
* @group Lifecycle
*/
disable(): Promise<void>;
/**
* Get the default permissions.
* @returns {string[]} The default permissions.
*/
getDefaultPermissions(): string[];
/**
* Get a player's permissions.
* @param {Player} player - The player to get permissions for.
* @returns {Promise<string[]>} A promise that resolves with the player's permissions.
*/
getPermissions(player: Player): Promise<string[]>;
/**
* Set a player's permissions.
*
* @remarks
* This will not be saved to the permissions.json file.
*
* @param {Player} player - The player to set permissions for.
* @param {string[]} [permissions=[]] - The permissions to set.
*/
setPermissions(player: Player, permissions?: string[]): void;
private parsePermissions;
private parseOps;
/**
* Set a player as an operator.
*
* @param {string} username - The player to set as an operator.
* @param {boolean} op - Whether the player should be an operator.
* @returns {Promise<boolean>} A promise that resolves with a boolean indicating whether the operation was successful.
*/
setOp(username: string, op: boolean): Promise<boolean>;
/**
* Check if a player is an operator.
*
* @param {string} username - The player to check.
* @returns {boolean} Whether the player is an operator.
*/
isOp(username: string): boolean;
/**
* Check if a player can execute a command.
*
* @param {Player} executer - The player to check.
* @returns {object} An object with an execute method that takes a permission string and returns whether the player can execute the command.
*/
can(executer?: Player): {
execute: (permission?: string) => boolean;
not: () => {
execute: (permission?: string) => boolean;
};
};
}
//# sourceMappingURL=PermissionManager.d.ts.map