Nukkit プラグイン Tips - plugin.yml -
まだ、公式の開発者向けWikiが整備されていないので、plugin.yml
の内容について解説しておく。
公式のサンプルコードをまずは載せる。
#name, main, version and api are required name: ExamplePlugin main: cn.nukkit.exampleplugin.ExamplePlugin #remember version and api is string, don't write it like this: 1.0.0, or there will be an exception version: "1.0.0" api: ["1.0.5"] load: POSTWORLD author: Nukkit Project # Authors and author will be added together in one list. authors: ["Example", "Another"] description: Example plugin showing the API website: https://github.com/NukkitX/ExamplePlugin # These dependencies are required for the plugin to start. #depend: ["OtherPlugin", "ThisPlugin"] # These dependencies are not required. softdepend: ["PluginA", "PluginB"] # Log prefix in console prefix: "Example" # Plugin will be loaded before these. Any cyclic loadbefore's or dependencies's will throw errors! loadbefore: ["ImportantPlugin"] commands: example: description: Example command usage: "/example" aliases: ["xample", "nukkitexample"] permission: exampleplugin.command.example permission-message: "You do not have the required permission to run /example" permissions: exampleplugin.command.example: description: "Allows the user to run the example command" default: true children: # exampleplugin.command.example.test: # description: "Use the test feature in the example command" # default: true
- name (必須)
プラグインの名前(半角英数字、_
、.
、-
、半角スペースが使用できる )
半角スペースだけ(例えばname: " "
)でも大丈夫なのが少し仕様としてもやっとしたりするけど、ちゃんと読み込める。
- main (必須)
メインクラスまでのパス。このパスを使って、ClassLoader
からロードする。なお、cn.nukkit.
から始まるものは使用できない。 - version (必須)
プラグインのバージョン。 - api (必須)
対応するNukkit API のバージョン。どれに対応するかは、version
コマンドで確認できる。
また、1.0.0 というような、「数字 . 数字 . 数字」という形式で書かなければいけない。文字列の配列を記入するが、書かれているAPI バージョンのいずれかが対応していれば、読み込むことができる。 load(初期値:
POSTWORLD
)
プラグインのロードされるタイミングを設定できる。現在、STARTUP
,POSTWORLD
を設定可能。
pekomemo.hatenablog.jpauthor
プラグインの著者。version <plugin name>
や、timings で表示される。authors
と共存可能。- authors
プラグインの著者(author
だと一つだが、authors
だと文字列の配列を記入できるので、複数著者がいるときは便利)。version <plugin name>
や、timings で表示される。author
と共存可能。 - description
プラグインの概要。version <plugin name>
や、timings で表示される。 - website
プラグインのWebサイト。version <plugin name>
や、timings で表示される。 - depend
このプラグインが依存しているプラグイン。依存するプラグインが読み込まれた後で、読み込まれる。(存在しない場合は以下のようなエラー)
01:54:59 [CRITICAL] プラグイン'Sample'を読み込むことができませんでした: 不明な依存関係 01:54:59 [CRITICAL] プラグイン'Sample'を読み込むことができませんでした: 循環依存が検出されました
- softdepend
このプラグインが依存しているプラグイン。depend
と違って、エラーは出ない。 - prefix
コンソールに出力されるログの先頭につく文字を設定できる。標準はプラグインのname
[Sample] onEnable
のSample
の部分。 commands
permissions
- description(必須)
権限の名前 default (デフォルト:
false
) 標準でだれが権限を所有するか。値 権限 op op isop op operator op isoperator op isopadmin op isadmin op !op notop notop notop !operator notop !admin notop notadmin notop true true children
- description(必須)