@@ -5,41 +5,62 @@ order: 95
55
66# Reference
77
8+ === Script
9+ Main script class available in the global scope of each script. Provides access to various utilities.
10+ ``` lua Variables
11+ --- Returns the name of the script.
12+ script .name : string
13+
14+ --- Returns the script's Logger instance.
15+ script .logger : Logger
16+ ```
17+ ``` lua Functions
18+ --- Registers a server command that players and console can execute.
19+ -- @param handler The command handler function
20+ -- @param metadata The command metadata table
21+ script :registerCommand (handler : (sender : CommandSender , args : table ) -> void , metadata : table ): void
22+
23+ --- Registers an event listener.
24+ -- @param event The event class
25+ -- @param handler The event handler function
26+ script :registerListener (event : string , handler : (event : Event ) -> void ): void
27+ ```
28+
829=== Scheduler
930Provides methods to schedule and manage tasks. It supports both synchronous and asynchronous task execution with various timing options.
1031
11- ``` lua
32+ ``` lua Functions
1233--- Schedules a task to run on the next tick.
1334-- @param handler The task function to execute
14- scheduler :run (handler : () -> void ): BukkitTask
35+ scheduler :run (handler : (BukkitRunnable ) -> void ): BukkitTask
1536
1637--- Schedules an asynchronous task to run on the next tick.
1738-- @param handler The task function to execute
18- scheduler :runAsync (handler : () -> void ): BukkitTask
39+ scheduler :runAsync (handler : (BukkitRunnable ) -> void ): BukkitTask
1940
2041--- Schedules a task to run after a delay (in ticks).
2142-- @param handler The task function to execute
2243-- @param delay Delay in ticks before execution
23- scheduler :runLater (handler : () -> void , delay : number ): BukkitTask
44+ scheduler :runDelayed (handler : (BukkitRunnable ) -> void , delay : number ): BukkitTask
2445
2546--- Schedules an asynchronous task to run after a delay (in ticks).
2647-- @param handler The task function to execute
2748-- @param delay Delay in ticks before execution
28- scheduler :runLaterAsync (handler : () -> void , delay : number ): BukkitTask
49+ scheduler :runDelayedAsync (handler : (BukkitRunnable ) -> void , delay : number ): BukkitTask
2950
3051--- Schedules a repeating task.
3152-- @param handler The task function to execute
3253-- @param delay Delay in ticks before first execution
3354-- @param period Interval in ticks between executions
34- scheduler :runRepeating (handler : () -> void , delay : number , period : number ): BukkitTask
55+ scheduler :runRepeating (handler : (BukkitRunnable ) -> void , delay : number , period : number ): BukkitTask
3556
3657--- Schedules an asynchronous repeating task.
3758-- @param handler The task function to execute
3859-- @param delay Delay in ticks before first execution
3960-- @param period Interval in ticks between executions
40- scheduler :runRepeatingAsync (handler : () -> void , delay : number , period : number ): BukkitTask
61+ scheduler :runRepeatingAsync (handler : (BukkitRunnable ) -> void , delay : number , period : number ): BukkitTask
4162
4263--- Cancels a task with the specified identifier.
4364-- @param task The task to cancel
44- scheduler :cancel (task : number ): void
45- ```
65+ scheduler :cancel (task : number | runnable : BukkitRunnable | task : BukkitTask ): void
66+ ```
0 commit comments