Skip to content

Commit e16b9d4

Browse files
committed
update "Getting Started" to match recent API changes
1 parent 8709af2 commit e16b9d4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

getting-started.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Basic **Lua** knowledge is an obvious prerequisite, but it should be relatively
3131

3232
### Creating Scripts
3333
There are a couple of things to keep in mind when using LuaLink.
34-
- Script life-cycle can be managed using `/lualink load`, `/lualink unload` and `/lualink reload` commands.
35-
<sup>More on this can be found on the **[Commands](commands.md)** page.</sup>
36-
- Each script is stored in a separate folder inside the `plugins/LuaLink/scripts` directory, and libraries are stored in the `plugins/LuaLink/libs` directory.
37-
<sup>More about libraries can be found on the **[Libraries](libraries.md)** page.</sup>
38-
- Entry point of the script (or library) is a file named `main.lua`.
39-
<sup>More files can be created and loaded using the `require` keyword.</sup>
34+
- Each script is stored in a separate folder inside the `plugins/LuaLink/scripts` directory.
35+
<sup>For example `/plugins/LuaLink/scripts/example/main.lua` will be loaded as `example` script.</sup>
36+
- Script life-cycle can be managed using `/lualink` command.
37+
<sup>Full command reference is available on the **[Commands](commands.md)** page.</sup>
38+
- Entry point of the script is a file named `main.lua`.
39+
<sup>More files can be imported using the `require` keyword.</sup>
4040

4141
<br />
4242

@@ -132,7 +132,7 @@ end, {
132132
aliases = {"e", "print"},
133133
permission = "scripts.command.echo",
134134
description = "Prints specified message to the sender.",
135-
usage = "/echo [player]",
135+
usage = "/echo [message]",
136136
tabComplete = onTabComplete
137137
})
138138
```
@@ -143,7 +143,7 @@ end, {
143143
Bukkit events can be hooked into relatively easily.
144144
```lua
145145
-- Called when player joins the server.
146-
script:registerEvent("org.bukkit.event.player.PlayerJoinEvent", function(event)
146+
script:registerListener("org.bukkit.event.player.PlayerJoinEvent", function(event)
147147
-- Getting player associated with the event.
148148
local player = event:getPlayer()
149149
-- Playing firework sound to the player.
@@ -159,27 +159,27 @@ end)
159159
Scheduler can be used to register single-use, delayed or repeating tasks.
160160
```lua
161161
-- Schedules a task to be run on the next tick.
162-
scheduler:run(function()
162+
scheduler:run(function(runnable)
163163
-- Whatever belongs to the task goes here.
164164
end)
165165

166166
-- Schedules a task to be run after 20 ticks has passed.
167-
scheduler:runLater(function()
167+
scheduler:runDelayed(function(runnable)
168168
-- Whatever belongs to the task goes here.
169169
end, 20)
170170

171171
-- Schedules a task to be run after 20 ticks has passed, and repeated every 160 ticks.
172-
scheduler:runRepeating(function()
172+
scheduler:runRepeating(function(runnable)
173173
-- Whatever belongs to the task goes here.
174174
end, 20, 160)
175175
```
176176

177177
Tasks can also be run asynchronously, but please note that neither the Bukkit API nor the LuaLink API is guaranteed to be thread-safe.
178178
```lua
179179
-- Schedules asynchronous task to be run on the next tick.
180-
scheduler:runAsync(handler: () -> void): BukkitTask
180+
scheduler:runAsync(handler: (BukkitRunnable) -> void): BukkitTask
181181
-- Schedules asynchronous task to be run after {delay} ticks has passed.
182-
scheduler:runLaterAsync(handler: () -> void, delay: number): BukkitTask
182+
scheduler:runDelayedAsync(handler: (BukkitRunnable) -> void, delay: number): BukkitTask
183183
-- Schedules task to be run after {delay} ticks has passed, and repeated every {period} ticks.
184-
scheduler:runRepeatingAsync(handler: () -> void, delay: number, period: number): BukkitTask
184+
scheduler:runRepeatingAsync(handler: (BukkitRunnable) -> void, delay: number, period: number): BukkitTask
185185
```

0 commit comments

Comments
 (0)