Skip to content

Commit eb9d393

Browse files
committed
docs: add warning about accessing resources before onLoad/onEnable
1 parent a927a8e commit eb9d393

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/en/guides/create_your_plugin.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ JSE.registerPlugin({
178178

179179
Now, when users execute the `/hello` command, the plugin will output `Hello world!`.
180180

181+
:::warning
182+
Due to issues with the loading mechanism, the engine needs to wait for ES (`Endstone`) to allocate some resources. Therefore, you cannot access any `Endstone` resources (such as `Logger`, etc.) before the `onLoad` method is called.
183+
You cannot access any Minecraft resources (such as `getServer`, etc.) before the `onEnable` method is called.
184+
`JSE`, `FileAPI` classes, and other Node APIs are not affected.
185+
:::
186+
181187
## 6. Compile and Run Plugin
182188

183189
After completing the plugin development, we need to compile it to JavaScript and then run it.

docs/zh/guides/create_your_plugin.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ JSE.registerPlugin({
178178

179179
这样,当用户执行 `/hello` 命令时,插件就会输出 `Hello world!`
180180

181+
:::warning
182+
由于加载机制问题,引擎需要等待 ES(`Endstone`)分配一些资源,所以在 `onLoad` 调用前您不能访问任何 `Endstone` 资源(如 `Logger` 等)。
183+
`onEnable` 调用前,您不能访问任何 Minecraft 资源(如 `getServer` 等)。
184+
`JSE``FileAPI` 类和其它 Node API 不受影响。
185+
:::
186+
181187
## 6. 编译并运行插件
182188

183189
在完成插件的编写后,我们需要将插件编译成 JavaScript,然后运行。

0 commit comments

Comments
 (0)