UNPKG

yoni-mcscripts-lib

Version:

为 Minecraft Script API 中的部分接口创建了 wrapper,并提供简单的事件管理器和任务管理器,另附有一些便于代码编写的一些小工具。

97 lines (96 loc) 4.36 kB
import { CommandPriority } from "./command/CommandPriority.js"; import { AsyncCommandSender } from "./command/AsyncCommandSender.js"; import { CommandSender } from "./command/CommandSender.js"; import { CommandResult } from "./command/CommandResult.js"; import { CommandExecutor } from "./command/CommandExecutor.js"; import { AsyncCommandExecutor } from "./command/AsyncCommandExecutor.js"; export { CommandPriority, AsyncCommandSender, CommandSender, CommandResult, CommandExecutor, AsyncCommandExecutor, }; export declare class Command { #private; static config: import("./index.js").Config; static PRIORITY_HIGHEST: CommandPriority; static PRIORITY_HIGH: CommandPriority; static PRIORITY_NORMAL: CommandPriority; static PRIORITY_LOW: CommandPriority; static PRIORITY_LOWEST: CommandPriority; /** * 返回队列中未执行的命令的数量 * @returns {number} */ static countQueues(): number; /** * Execute a command asynchronously * @param {string} command */ static fetch(command: string): Promise<CommandResult>; /** * execute a command asynchronously with params * @param {...string} params - Command params * @returns {Promise<CommandResult>} */ static fetchParams(command: string, ...params: string[]): Promise<CommandResult>; /** * execute a command with params by specific sender * @param {AsyncCommandSender} sender - Command's sender * @param {...string} params - command params * @returns {Promise<CommandResult>} */ static fetchExecuteParams(sender: AsyncCommandSender, command: string, ...params: string[]): Promise<CommandResult>; /** * execute a command by specific sender * @param {AsyncCommandSender} sender - Command's sender * @returns {Promise<CommandResult>} */ static fetchExecute(sender: AsyncCommandSender, command: string): Promise<CommandResult>; /** * add a command to specific priority to execute * @param {CommandPriority} priority * @param {string} command * @returns {Promise<CommandResult>} */ static add(priority: CommandPriority, command: string): Promise<CommandResult>; /** * add a command with params to specific priority to execute * @param {CommandPriority} priority * @param {...string} params * @returns {Promise<CommandResult>} */ static addParams(priority: CommandPriority, command: string, ...params: string[]): Promise<CommandResult>; /** * add a command with params to specific priority to execute by sender * @param {CommandPriority} priority * @param {AsyncCommandSender} sender * @param {...string} params * @returns {Promise<CommandResult>} */ static addExecuteParams(priority: CommandPriority, sender: AsyncCommandSender, command: string, ...params: string[]): Promise<CommandResult>; /** * 在对象上调用 `runCommandAsync` 执行命令。 * @param {CommandPriority} priority * @param {AsyncCommandSender} sender * @param {string} command * @returns {Promise<CommandResult>} */ static addExecute(priority: CommandPriority, sender: AsyncCommandSender, command: string): Promise<CommandResult>; static addSyncExecute(priority: CommandPriority, sender: CommandSender, command: string): Promise<CommandResult>; /** * generates a command by a set of params, and try to make sure that every arg is standalone * @param {string} cmd * @param {string[]|...string} args * @returns {string} command */ static getCommand(command: string, ...args: string[]): string; static getCommand(command: string, args: string[]): string; static getCommandMoreStrict(command: string, ...args: string[]): string; static getCommandMoreStrict(command: string, args: string[]): string; /** * execute a set of commands by sender * @param {AsyncCommandSender} sender * @param {string[]} commands - command * @returns {Promise<CommandResult[]>} */ static postExecute(sender: AsyncCommandSender, commands: string[]): Promise<CommandResult[]>; static run(command: string): CommandResult; static execute(sender: CommandSender, command: string): CommandResult; static generateCommandResult(isSuccess: boolean, value: any): CommandResult; }