mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 08:22:33 +00:00
34 lines
1.4 KiB
Plaintext
34 lines
1.4 KiB
Plaintext
/// The core context provided to a plugin during initialization and event handling.
|
|
interface context {
|
|
use server.{server};
|
|
use event.{event-type, event-priority};
|
|
use command.{command};
|
|
use permission.{permission};
|
|
|
|
/// A contextual handle for plugin-related operations.
|
|
resource context {
|
|
/// Registers a handler for a specific event.
|
|
///
|
|
/// * `handler-id`: Unique ID for the event handler.
|
|
/// * `event-type`: The type of event to listen for.
|
|
/// * `event-priority`: When this handler should be called relative to others.
|
|
/// * `blocking`: Whether the event should wait for this handler to finish.
|
|
register-event: func(handler-id: u32, event-type: event-type, event-priority: event-priority, blocking: bool);
|
|
|
|
/// Registers a new command.
|
|
///
|
|
/// * `command`: The command definition.
|
|
/// * `permission`: The required permission node to execute this command.
|
|
register-command: func(command: command, permission: string);
|
|
|
|
/// Registers a permission node with the server.
|
|
register-permission: func(permission: permission) -> result<_, string>;
|
|
|
|
/// Returns the path to the plugin's private data folder.
|
|
get-data-folder: func() -> string;
|
|
|
|
/// Returns the global server instance.
|
|
get-server: func() -> server;
|
|
}
|
|
}
|