Getting Started - HimxhMC/HimDSL GitHub Wiki

安装与快速开始 / Installation & Quick Start

你需要准备什么 / What You Need

在开始之前,确认你的服务器符合以下条件:

  • 一个 Bukkit / Spigot / Paper 服务端(推荐 Paper)。
  • Java 17 或更高版本。
  • 最新版的 HimDSL 插件 jar 文件。

Before starting, make sure your server meets these requirements:

  • A Bukkit / Spigot / Paper server (Paper recommended).
  • Java 17 or later.
  • The latest HimDSL plugin jar.

安装 / Installation

安装只有三步:

  1. 把 HimDSL-x.y.z.jar 放进服务器的 plugins/ 目录。
  2. 重启服务器。
  3. 看到控制台输出 [HimDSL] HimDSL enabled. 就说明安装成功。

第一次启动后,插件会自动创建 plugins/HimDSL/ 目录。所有脚本文件都放在这个目录里。

Installation takes three steps:

  1. Place HimDSL-x.y.z.jar into the server's plugins/ directory.
  2. Restart the server.
  3. Seeing [HimDSL] HimDSL enabled. in the console means success.

On first launch, the plugin automatically creates the plugins/HimDSL/ folder. All scripts live there.


第一个脚本 / Your First Script

在 plugins/HimDSL/ 里新建一个文件,命名为 hello.himdsl,写入以下内容:

Create a new file named hello.himdsl inside plugins/HimDSL/, with the following content:

int main() {
    runcmd("CONSOLE", "say Hello, HimDSL!");
}

这个脚本做的事情很简单:以控制台身份执行 /say Hello, HimDSL!,所有在线玩家都会看到这条广播。

This script is simple: it runs /say Hello, HimDSL! as the console, so every online player sees the broadcast.


运行脚本 / Running the Script

在服务器控制台或以 OP 身份在游戏里执行:

Run from the server console, or in-game as an operator:

/himdsl run hello.himdsl

如果成功,你会看到 执行完成。 的提示,游戏内所有玩家收到广播。如果脚本有语法错误,命令会返回错误提示,并指出大致位置。

If successful, you see 执行完成。 and every online player receives the broadcast. If the script has a syntax error, the command returns an error with a rough location.


命令速览 / Commands at a Glance

HimDSL 目前提供三个子命令:

  • /himdsl compile <文件> —— 只检查语法,不执行。
  • /himdsl run <文件> —— 执行脚本。
  • /himdsl debug on|off —— 打开或关闭详细日志。

路径是相对于 plugins/HimDSL/ 的相对路径,例如 scripts/hello.himdsl。脚本文件必须放在这个目录里,插件不会执行目录之外的文件。

HimDSL currently offers three subcommands:

  • /himdsl compile <file> — syntax check only, no execution.
  • /himdsl run <file> — execute the script.
  • /himdsl debug on|off — toggle verbose logging.

Paths are relative to plugins/HimDSL/, for example scripts/hello.himdsl. Scripts must live inside this directory; the plugin will not execute files outside it.


服务器启动 / 关闭时自动执行 / Auto-run on Startup / Shutdown

如果你在 plugins/HimDSL/ 目录下创建名为 onServerLoad.himdsl 和 onServerShutdown.himdsl 的文件,插件会在服务器启动完成、以及插件关闭时自动运行它们。它们的写法与普通脚本完全一样,也以 main 作为入口。

If you create files named onServerLoad.himdsl and onServerShutdown.himdsl inside plugins/HimDSL/, the plugin runs them automatically when the server finishes loading, and when the plugin shuts down. Their structure is identical to ordinary scripts, with main as the entry point.

例如:

For example:

int main() {
    runcmd("CONSOLE", "say 服务器已就绪。");
}

常见问题 / Troubleshooting

  • 提示"文件不存在":检查路径是否相对于 plugins/HimDSL/,注意大小写。

  • 提示"文件路径必须在插件目录内":说明路径指向了插件目录之外,把脚本移回 plugins/HimDSL/ 里。

  • **命令没反应:确认执行者拥有对应权限(himdsl.use / himdsl.run / himdsl.debug),或没有被权限插件拦截。

  • 控制台没有 "HimDSL enabled.":jar 未加载。检查服务端版本、Java 版本是否匹配,查看 logs/latest.log。

  • "File not found": check the path is relative to plugins/HimDSL/; mind case sensitivity.

  • "Path must be inside the plugin directory": move the script back into plugins/HimDSL/.

  • Command does nothing: confirm the executor has the matching permission (himdsl.use / himdsl.run / himdsl.debug), or isn't blocked by a permissions plugin.

  • No "HimDSL enabled." in console: the jar did not load. Verify server and Java versions; check logs/latest.log.


下一步 / Next Steps

现在你已经装好插件,也跑通了第一个脚本。接下来请翻到 [第一个脚本 / First-Script],我们会写一个能读取玩家数据、并根据数据做出反应的脚本。

You've installed the plugin and run your first script. Turn to [第一个脚本 / First-Script], where we write a script that reads player data and reacts to it.


⚠️ **GitHub.com Fallback** ⚠️