Skip to content
This repository was archived by the owner on Dec 22, 2025. It is now read-only.

Commit 7f178cd

Browse files
committed
添加事件文档
1 parent b3b0c49 commit 7f178cd

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default defineConfig({
1919
collapsed: false,
2020
items: [
2121
{ text: "概述", link: "plugin/overview" },
22+
{ text: "事件", link: "plugin/event" }
2223
]
2324
},
2425
{

plugin/event.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: 事件
3+
---
4+
5+
# 事件系统
6+
7+
新插件系统的事件注册方式和Bukkit不一样,主要因为Bukkit用java、LemonMint用Lua,所以导致的插件写法的不同。但是LemonMint的事件注册难度其实比Bukkit还低。
8+
9+
## 基本运用
10+
11+
> 该插件系统暂时只有玩家加入游戏事件(
12+
13+
```lua
14+
local plugin = function(plugin)
15+
-- 玩家加入事件
16+
local join = function(event)
17+
event.setJoinMessage("Welcome " .. event.player.name .. " Join this server!!")
18+
end
19+
20+
plugin.enable = function()
21+
-- 注册事件
22+
plugin.event.listen("player_join", join)
23+
end
24+
end
25+
26+
-- 编写meta和注册自己明白
27+
```

0 commit comments

Comments
 (0)