Skip to content

Latest commit

 

History

History
99 lines (85 loc) · 3.92 KB

File metadata and controls

99 lines (85 loc) · 3.92 KB
icon order
code
95

Reference

==- Core Components Libraries and utilities exposed to the script environment.

{.list-icon}

  • Core Libraries
    • :icon-package: string
    • :icon-package: table
    • :icon-package: math
    • :icon-package: io
    • :icon-package: os
    • :icon-package: java
  • Core Functions
  • Global Variables
    • :icon-italic: script
    • :icon-italic: server
    • :icon-italic: scheduler ==-

=== Script Main script class available in the global scope of each script. Provides access to various utilities.

--- Returns the name of the script.
script.name: string

--- Returns the script's Logger instance.
script.logger: Logger
--- Registers a server command that players and console can execute.
--  @param handler The command handler function
--  @param metadata The command metadata table
script:registerCommand(handler: (sender: CommandSender, args: table) -> void, metadata: table): void

--- Registers an event listener.
--  @param event The event class
--  @param handler The event handler function
script:registerListener(event: string, handler: (event: Event) -> void): void

===

=== Scheduler Provides methods to schedule and manage tasks. It supports both synchronous and asynchronous task execution with various timing options.

--- Schedules a task to run on the next tick.
--  @param handler The task function to execute
scheduler:run(handler: (BukkitRunnable) -> void): BukkitTask

--- Schedules an asynchronous task to run on the next tick.
--  @param handler The task function to execute
scheduler:runAsync(handler: (BukkitRunnable) -> void): BukkitTask

--- Schedules a task to run after a delay (in ticks).
--  @param handler The task function to execute
--  @param delay Delay in ticks before execution
scheduler:runDelayed(handler: (BukkitRunnable) -> void, delay: number): BukkitTask

--- Schedules an asynchronous task to run after a delay (in ticks).
--  @param handler The task function to execute
--  @param delay Delay in ticks before execution
scheduler:runDelayedAsync(handler: (BukkitRunnable) -> void, delay: number): BukkitTask

--- Schedules a repeating task.
--  @param handler The task function to execute
--  @param delay Delay in ticks before first execution
--  @param period Interval in ticks between executions
scheduler:runRepeating(handler: (BukkitRunnable) -> void, delay: number, period: number): BukkitTask

--- Schedules an asynchronous repeating task.
--  @param handler The task function to execute
--  @param delay Delay in ticks before first execution
--  @param period Interval in ticks between executions
scheduler:runRepeatingAsync(handler: (BukkitRunnable) -> void, delay: number, period: number): BukkitTask

--- Cancels the provided task.
--  @param taskId The id of the tas to cancel
--  @param runnable The runnable instance of the task to cancel
--  @param task The task to cancel
scheduler:cancel(taskId: number | runnable: BukkitRunnable | task: BukkitTask): void

===