`
+
+
+
+### 设置指定响应头的值
+
+`req.setHeader(name, value)`
+
+- 参数:
+ - name : `String`
+ 响应头名称
+ - value : `Any`
+ 响应头值
+- 返回值:处理完毕的响应对象
+- 返回值类型:`HttpResponse`
+
+
+
+### 写入响应内容
+
+`res.write(content1, content2, ...)`
+
+- 参数:
+ - content : `Any`
+ 响应内容
+- 返回值:处理完毕的响应对象
+- 返回值类型:`HttpResponse`
+- 注:本函数在目前相当于`res.body += content1 + content2 + ...`
+
+
+
+## Http API 样例
+
+```js
+let server = new HttpServer();
+server.onGet("/hello(.+)", (req, resp) => {
+ logger.info("http_server_test: run: onGet: Received a request from ", req.remoteAddr,
+ ':', req.remotePort, " for ", req.path);
+ resp.write("")
+ .write("It works!
")
+ .write("
")
+ .write("Request Headers: ", JSON.stringify(req.headers, null, 4), "
")
+ .write("Request Body: ", req.body, "
")
+ .write("Your Address: ", req.remoteAddr, ':', req.remotePort, "
")
+ .write("HTTP Version: ", req.version, "
")
+ .write("Method: ", req.method, "
")
+ .write("Path: ", req.path, "
")
+ .write("Parsed Query: ", JSON.stringify(req.query, null, 4), "
")
+ .write("Path Regex Matches: ", JSON.stringify(req.matches), "
")
+ .write("")
+ resp.status = 200;
+ resp.reason = "OK";
+ resp.setHeader("Content-Type", "text/html");
+}).onGet("/404", (req, resp) => {
+ resp.status = 404;
+ resp.reason = "Not Found";
+ resp.write("Not Found");
+}).onGet("/test-redirect", (req, resp) => {
+ // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Redirections
+ resp.status = 301;
+ resp.reason = "Moved Permanently";
+ resp.setHeader("Location", "https://github.com");
+}).onGet("/(.+)", (req, resp) => {
+ resp.write("Hello World! ", req.matches);
+}).onPreRouting((req, resp) => {
+ logger.info("http_server_test: run: onPreRouting: resp.body.length: ", resp.body.length);
+ if (req.path == "/test-prerouting") {
+ resp.body = "Hello World!";
+ resp.status = 200;
+ resp.reason = "OK";
+ return false;
+ }
+}).onPostRouting((req, resp) => {
+ logger.info("http_server_test: run: onPostRouting: resp.body.length: ", resp.body.length);
+}).onError((req, resp) => {
+ resp.write("\nonError called");
+}).listen(this.listen_address, this.listen_port);
+logger.info("http_server_test: run: Server listening on " + this.listen_address + ":" + this.listen_port);
+```
+请查看 [UnitTest](https://github.com/LiteLDev/LiteLoaderBDSv2/tree/main/Test/UnitTest.js)
diff --git a/docs/apis/SystemAPI/SystemCall.md b/docs/apis/SystemAPI/SystemCall.md
new file mode 100644
index 00000000..a6e870cc
--- /dev/null
+++ b/docs/apis/SystemAPI/SystemCall.md
@@ -0,0 +1,56 @@
+## 📡 System Call API
+
+The following APIs provide interfaces to perform some system calls:
+
+### Invoke the Shell to Execute the Specified System Command
+
+`system.cmd(cmd,callback[,timeLimit])`
+
+- Parameters:
+ - cmd : `String`
+ The executed system command.
+ - callback : `Function`
+ The callback function used to return data after the system process ends.
+ - timeLimit : `Integer`
+ (Optional parameter) The maximum time for the command to run, in milliseconds.
+ The default is `-1`, i.e. unlimited runtime
+- Return value: Whether the command was successfully started.
+- Return value type: `Boolean`
+
+Note: The prototype of the callback function of the parameter callback: `function(exitcode,output)`
+
+- exitcode : `Integer`
+ The process exit code.
+- output : `String`
+ The contents of standard output and standard error.
+
+Notice! What is executed here is not the command of the MC command system.
+This function works asynchronously. It will not wait for the system to execute the command before returning, but the engine will automatically call the given callback function to return the result.
+
+
+
+### Run the Specified Location Program
+
+`system.newProcess(process,callback[,timeLimit])`
+
+- Parameters:
+ - process : `String`
+ The path of the program to run (with command line arguments).
+ - callback : `Function`
+ The callback function used to return data after the program process ends.
+ - timeLimit : `Integer`
+ (Optional parameter) The maximum time limit for the program process to run, in milliseconds.
+ The default is `-1`, i.e. unlimited runtime.
+- Return value: Whether the process was successfully started.
+- Return value type: `Boolean`
+
+Note: The prototype of the callback function of the parameter callback: `function(exitcode,output)`
+
+- exitcode : `Integer`
+ Process exit code.
+- output : `String`
+ The contents of the program's standard output and standard error output.
+
+This function works asynchronously. It will not wait for the system to execute the command before returning, but the engine will automatically call the given callback function to return the result.
+
+
\ No newline at end of file
diff --git a/docs/apis/SystemAPI/SystemCall.zh.md b/docs/apis/SystemAPI/SystemCall.zh.md
new file mode 100644
index 00000000..4e4e04b8
--- /dev/null
+++ b/docs/apis/SystemAPI/SystemCall.zh.md
@@ -0,0 +1,56 @@
+## 📡 系统调用 API
+
+下面这些API提供了执行一些系统调用的接口
+
+### 调用shell执行指定系统命令
+
+`system.cmd(cmd,callback[,timeLimit])`
+
+- 参数:
+ - cmd : `String`
+ 执行的系统命令
+ - callback : `Function`
+ shell进程结束之后返回数据使用的回调函数
+ - timeLimit : `Integer`
+ (可选参数)命令运行的最长时限,单位为毫秒
+ 默认为`-1`,即不限制运行时间
+- 返回值:是否成功启动命令
+- 返回值类型:`Boolean`
+
+注:参数callback的回调函数原型:`function(exitcode,output)`
+
+- exitcode : `Integer`
+ shell退出码
+- output : `String`
+ 标准输出和标准错误输出的内容
+
+注意!这里执行的不是MC命令系统的命令
+此函数异步工作,不会等待系统执行完命令后再返回,而是由引擎自动调用给出的回调函数来返回结果
+
+
+
+### 运行指定位置程序
+
+`system.newProcess(process,callback[,timeLimit])`
+
+- 参数:
+ - process : `String`
+ 运行的程序路径(与命令行参数)
+ - callback : `Function`
+ 程序进程结束之后返回数据使用的回调函数
+ - timeLimit : `Integer`
+ (可选参数)程序进程运行的最长时限,单位为毫秒
+ 默认为`-1`,即不限制运行时间
+- 返回值:是否成功启动进程
+- 返回值类型:`Boolean`
+
+注:参数callback的回调函数原型:`function(exitcode,output)`
+
+- exitcode : `Integer`
+ 程序进程退出码
+- output : `String`
+ 程序标准输出和标准错误输出的内容
+
+此函数异步工作,不会等待系统执行完命令后再返回,而是由引擎自动调用给出的回调函数来返回结果
+
+
\ No newline at end of file
diff --git a/docs/apis/SystemAPI/SystemInfo.md b/docs/apis/SystemAPI/SystemInfo.md
new file mode 100644
index 00000000..ef83aa27
--- /dev/null
+++ b/docs/apis/SystemAPI/SystemInfo.md
@@ -0,0 +1,44 @@
+## 📜 Get System Information API
+
+The following APIs provide interfaces to obtain necessary system information:
+
+### Get Current Time String
+
+`system.getTimeStr()`
+
+- Return value: The current time string, using the local time zone and 24-hour clock.
+ For example: `2021-04-03 19:15:01`
+- Return value type: `String`
+
+
+
+### Get the Current Time Object
+
+`system.getTimeObj()`
+
+- Return value: The current time object `Object`)
+
+- Return value type: `Object`
+
+ - For the returned time object tm, there are the following members:
+
+ | Field | Meaning | Data Type |
+ | ----- | -------------------- | --------- |
+ | tm.Y | Year value (4 digits)| `Integer` |
+ | tm.M | Month value | `Integer` |
+ | tm.D | Day value | `Integer` |
+ | tm.h | Hour value (24-hour clock)|`Integer` |
+ | tm.m | Minute value | `Integer` |
+ | tm.s | Seconds value | `Integer` |
+ | tm.ms | Millisecond value | `Integer` |
+
+
+
+### Randomly Generate a Guid String
+
+`system.randomGuid()`
+
+- Return value: A randomly generated unique identifier GUID.
+- Return value type: `String`
+
+
\ No newline at end of file
diff --git a/docs/apis/SystemAPI/SystemInfo.zh.md b/docs/apis/SystemAPI/SystemInfo.zh.md
new file mode 100644
index 00000000..fa248781
--- /dev/null
+++ b/docs/apis/SystemAPI/SystemInfo.zh.md
@@ -0,0 +1,44 @@
+## 📜 获取系统信息 API
+
+下面这些API提供了获取必要的系统信息的接口
+
+### 获取当前时间字符串
+
+`system.getTimeStr()`
+
+- 返回值:当前的时间字符串,使用当地时区和24小时制。
+ 形如`2021-04-03 19:15:01`
+- 返回值类型:`String`
+
+
+
+### 获取当前的时间对象
+
+`system.getTimeObj()`
+
+- 返回值:当前的时间对象(`Object`)
+
+- 返回值类型: `Object`
+
+ - 对于返回的某个时间对象 tm,有如下这些成员:
+
+ | 成员 | 含义 | 类型 |
+ | ----- | -------------------- | --------- |
+ | tm.Y | 年份数值(4位) | `Integer` |
+ | tm.M | 月份数值 | `Integer` |
+ | tm.D | 天数数值 | `Integer` |
+ | tm.h | 小时数值(24小时制) | `Integer` |
+ | tm.m | 分钟数值 | `Integer` |
+ | tm.s | 秒数值 | `Integer` |
+ | tm.ms | 毫秒数值 | `Integer` |
+
+
+
+### 随机生成一个 GUID 字符串
+
+`system.randomGuid()`
+
+- 返回值:一个随机生成的唯一标识符GUID
+- 返回值类型: `String`
+
+
\ No newline at end of file
diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 00000000..e69de29b
diff --git a/docs/img/logo.png b/docs/img/logo.png
new file mode 100644
index 00000000..7761c0dd
Binary files /dev/null and b/docs/img/logo.png differ
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 00000000..e69de29b
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 00000000..eb50f2e9
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,122 @@
+site_name: LegacyScriptEngine
+repo_url: https://github.com/LiteLDev/LegacyScriptEngine
+
+nav:
+ - Home: index.md
+
+ - faq.md
+
+ - APIs:
+ - README: apis/README.md
+ - DataAPI:
+ - apis/DataAPI/ConfigFile.md
+ - apis/DataAPI/DataBase.md
+ - apis/DataAPI/Economy.md
+ - apis/DataAPI/OtherData.md
+ - apis/DataAPI/PermAPI.md
+ - apis/DataAPI/PlayerData.md
+ - EventAPI:
+ - apis/EventAPI/BlockEvents.md
+ - apis/EventAPI/EconomicEvents.md
+ - apis/EventAPI/EntityEvents.md
+ - apis/EventAPI/Listen.md
+ - apis/EventAPI/OtherEvents.md
+ - apis/EventAPI/PlayerEvents.md
+ - GameAPI:
+ - apis/GameAPI/Basic.md
+ - apis/GameAPI/Block.md
+ - apis/GameAPI/BlockEntity.md
+ - apis/GameAPI/Command.md
+ - apis/GameAPI/Container.md
+ - apis/GameAPI/Device.md
+ - apis/GameAPI/Entity.md
+ - apis/GameAPI/GameUtils.md
+ - apis/GameAPI/Item.md
+ - apis/GameAPI/Packet.md
+ - apis/GameAPI/Particle.md
+ - apis/GameAPI/Player.md
+ - apis/GameAPI/ScoreBoard.md
+ - apis/GameAPI/Server.md
+ - GuiAPI:
+ - apis/GuiAPI/Form.md
+ - apis/GuiAPI/FormBuilder.md
+ - NativeAPI:
+ - apis/NativeAPI/NativeFunction.md
+ - apis/NativeAPI/NativePatch.md
+ - apis/NativeAPI/NativePointer.md
+ - apis/NativeAPI/Summary.md
+ - NbtAPI:
+ - apis/NbtAPI/NBT.md
+ - apis/NbtAPI/NBTCompound.md
+ - apis/NbtAPI/NBTList.md
+ - apis/NbtAPI/NBTValue.md
+ - ScriptAPI:
+ - apis/ScriptAPI/i18n.md
+ - apis/ScriptAPI/Ll.md
+ - apis/ScriptAPI/Logger.md
+ - apis/ScriptAPI/ScriptHelp.md
+ - SystemAPI:
+ - apis/SystemAPI/File.md
+ - apis/SystemAPI/FileSystem.md
+ - apis/SystemAPI/Network.md
+ - apis/SystemAPI/SystemCall.md
+ - apis/SystemAPI/SystemInfo.md
+
+exclude_docs: |
+ api/native/
+
+theme:
+ name: material
+ features:
+ - navigation.tabs
+ - navigation.tabs.sticky
+ favicon: img/logo.png
+ logo: img/logo.png
+ palette:
+ primary: white
+
+markdown_extensions:
+ - abbr
+ - admonition
+ - attr_list
+ - def_list
+ - footnotes
+ - md_in_html
+ - toc
+ - tables
+ - pymdownx.arithmatex
+ - pymdownx.betterem
+ - pymdownx.caret
+ - pymdownx.mark
+ - pymdownx.tilde
+ - pymdownx.critic
+ - pymdownx.details
+ - pymdownx.emoji
+ - pymdownx.highlight:
+ auto_title: true
+ linenums: true
+ - pymdownx.inlinehilite
+ - pymdownx.keys
+ - pymdownx.smartsymbols
+ - pymdownx.snippets
+ - pymdownx.superfences
+ - pymdownx.tabbed:
+ alternate_style: true
+ - pymdownx.tasklist
+
+plugins:
+ - i18n:
+ languages:
+ - locale: en
+ default: true
+ name: English
+
+ - locale: zh
+ name: 中文
+ nav_translations:
+ Home: 主页
+ Install: 安装
+ APIs: API
+
+
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..5ef9ad55
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,29 @@
+Babel==2.12.1
+certifi==2023.7.22
+charset-normalizer==3.2.0
+click==8.1.7
+colorama==0.4.6
+ghp-import==2.1.0
+idna==3.4
+Jinja2==3.1.2
+Markdown==3.4.4
+MarkupSafe==2.1.3
+mergedeep==1.3.4
+mkdocs==1.5.2
+mkdocs-material==9.3.1
+mkdocs-material-extensions==1.1.1
+mkdocs-static-i18n==1.0.3
+packaging==23.1
+paginate==0.5.6
+pathspec==0.11.2
+platformdirs==3.10.0
+Pygments==2.16.1
+pymdown-extensions==10.3
+python-dateutil==2.8.2
+PyYAML==6.0.1
+pyyaml_env_tag==0.1
+regex==2023.8.8
+requests==2.31.0
+six==1.16.0
+urllib3==2.0.4
+watchdog==3.0.0