Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 31 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

English | [日本語](README_JA.md)

Generates a server-specific Skript syntax snapshot for LSP and tooling use. The snapshot records the active Skript version, server, plugins, registration order, capabilities, and 19 data files behind a stable schema.
Generates a server-specific Skript syntax snapshot for LSP and tooling use. The snapshot records the active Skript version, server, plugins, registration order, capabilities, and 20 data files behind a stable schema.

For a field-by-field description of every generated file, including nullability, value ranges, concepts, and version differences, see the [snapshot JSON format reference](docs/json-format.md).

## Generator artifacts

Two adapters write the same 20-file snapshot contract:
Two adapters write the same 21-file snapshot contract: 20 data files plus `Manifest.json`.

| Skript | Artifact | Runtime |
| --- | --- | --- |
Expand All @@ -17,19 +17,21 @@ Two adapters write the same 20-file snapshot contract:

Place the matching artifact in the server's `plugins` directory, start the server, and run `/skgen`. Files are written to `plugins/SkriptSyntaxGenerator` by default. A server snapshot should be generated again whenever the server, Skript, installed addons, or addon load order changes.

Both adapters always emit the same files. Features unavailable in an older Skript version use the contract's empty root (`[]`, `{}` for `Operations.json`, or the documented object roots for `Aliases.json`, `Language.json`, and `PluralRules.json`) and are described by `Manifest.json.capabilities`.
Both adapters always emit the same files. Features unavailable in an older Skript version use the contract's empty root (`[]`, `{}` for `Operations.json`, or the documented object roots for `Aliases.json`, `BlockData.json`, `Language.json`, and `PluralRules.json`) and are described by the relevant file state or `Manifest.json.capabilities`.

## Manifest capabilities

`Manifest.json` uses schema version 6 and records:
`Manifest.json` uses schema version 7 and records:

- `syntaxApi`: `legacy-static` or `registry`
- `eventValueApi`: `legacy`, `modern-2.15`, or `modern-2.16`
- `syntaxKinds`: availability of each collected registry
- `aliases.supported` and `aliases.collected`

Schema 6 replaces the former `Types.json.defaultExpressionClass` scalar with
structured `defaultExpression` metadata. It records the implementation class
`BlockData.json` has its own runtime state because BlockData availability depends on the Minecraft/Bukkit API, not only on the Skript version. Consumers should use that file's `state` and `complete` fields instead of inferring support from `syntaxKinds`.

Schema 6 introduced, and schema 7 retains, the replacement of the former
`Types.json.defaultExpressionClass` scalar with structured `defaultExpression` metadata. It records the implementation class
and whether the implementation is a literal, plus `returnType` and `single`
when those methods can be queried without parse context. Time-state and
initialization checks remain parser/WASM responsibility.
Expand Down Expand Up @@ -68,22 +70,24 @@ initialization remains parser/WASM work.

Supporting registries and relationships:

| Skript | Arithmetic | Converters | Comparators | Event values | Properties | Class hierarchy | Global aliases | Language registry | Plural rules |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2.6.4 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.7.3 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.8.7 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.9.5 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.10.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.11.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.12.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.13.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.14.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.15.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.16.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Skript | Arithmetic | Converters | Comparators | Event values | Properties | Class hierarchy | Global aliases | Language registry | Plural rules | Block data |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2.6.4 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.7.3 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.8.7 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.9.5 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.10.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.11.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.12.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.13.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.14.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.15.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.16.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |

`Arithmetic` covers `Operators.json`, `Operations.json`, and `Differences.json` as one capability. `Plural rules` covers `PluralRules.json`; every supported Skript version has a built-in conversion table, while `pluralOverrideSupported` records whether addons can prepend runtime overrides. Event values are available for every tested version, but their metadata shape changes: 2.6.4-2.14.3 use `eventValueApi: legacy`, while 2.15.4 and 2.16.0 expose the `modern-2.16` shape. The exact detected shape must be read from the Manifest instead of inferred only from the Skript version.

`Block data` is runtime-dependent: Minecraft 1.13 and newer can report `collected` when the Bukkit/BlockState registry is readable; Minecraft 1.12.2 and older report `unsupported`; a registry/API inspection failure reports `unresolved`. The table's `Runtime` value intentionally avoids pretending that this is a Skript-only capability.

Skript 2.6.4 has no enumerable Structure registry. Its command, function, options, variables, aliases, and event top-level constructs are handled by dedicated `ScriptLoader` branches. They are not synthesized into `Structures.json`, because this generator preserves registered raw data instead of reconstructing syntax declarations.

## Compatibility matrix
Expand All @@ -103,6 +107,14 @@ The integration suite currently covers these boundaries:
| 2.15.4 | 26.1.2 | 25 | experimental current API |
| 2.16.0 | 26.2 | 25 | experimental current API |

BlockData compatibility is determined by the Minecraft runtime:

| Minecraft runtime | `BlockData.json.state` | Meaning |
| --- | --- | --- |
| 1.13+ | `collected` | Read from the runtime Bukkit/BlockState registry without a hardcoded block list. |
| 1.12.2 and older | `unsupported` | The `org.bukkit.block.data.BlockData` API is unavailable. |
| Any version with an inspection failure | `unresolved` | The API exists or was expected, but the registry could not be read safely. |

The `2.6.4 + Minecraft 1.12.2 + Java 8` profile is a required compatibility test, not an inferred target.

Minecraft 1.16.5, 1.17.1, 1.18.2, 26.1.2, and 26.2 are representative patch releases selected from [Skript's bStats Minecraft Version chart](https://bstats.org/plugin/bukkit/Skript/722). The chart changes over time; these profiles cover the currently significant version families without replacing the Skript API boundary profiles. Paper 26 currently prevents complete registration-hook capture through plugin class-loader isolation, so its profiles remain available as explicit experimental tasks but are excluded from `integrationTest`. The interactive `runServer` task uses Skript 2.15.4 on Paper 1.21.11.
Expand Down
42 changes: 25 additions & 17 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

[English](README.md) | 日本語

LSPや各種ツールで利用するために、サーバー固有のSkript構文スナップショットを生成します。スナップショットには、安定したスキーマのもとで、使用中のSkriptバージョン、サーバー、プラグイン、登録順序、capability、および19個のデータファイルが記録されます
LSPや各種ツールで利用するために、サーバー固有のSkript構文スナップショットを生成します。スナップショットには、安定したスキーマのもとで、使用中のSkriptバージョン、サーバー、プラグイン、登録順序、capability、および20個のdata fileが記録されます

生成される全ファイルについて、各フィールド、null・省略、値域、概念、バージョン差を確認するには、[スナップショットJSON形式リファレンス](docs/json-format.ja.md)を参照してください。

## Generatorの成果物

2種類のadapterが、同じ20ファイルのスナップショット契約に従って出力します
2種類のadapterが、20個のdata fileと`Manifest.json`を含む同じ21ファイルのスナップショット契約に従って出力します

| Skript | 成果物 | 実行環境 |
| --- | --- | --- |
Expand All @@ -17,11 +17,11 @@ LSPや各種ツールで利用するために、サーバー固有のSkript構

対応する成果物をサーバーの`plugins`ディレクトリに配置し、サーバーを起動して`/skgen`を実行してください。デフォルトでは、ファイルは`plugins/SkriptSyntaxGenerator`に出力されます。サーバー、Skript、導入addon、またはaddonの読み込み順序が変わった場合は、サーバースナップショットを再生成してください。

どちらのadapterも常に同じファイルを出力します。古いSkriptバージョンで利用できない機能は、契約で定めた空のroot(`[]`、`Operations.json`では`{}`、`Aliases.json`、`Language.json`、`PluralRules.json`では文書化されたobject root)として出力され、利用可否は`Manifest.json.capabilities`に記録されます。
どちらのadapterも常に同じファイルを出力します。古いSkriptバージョンで利用できない機能は、契約で定めた空のroot(`[]`、`Operations.json`では`{}`、`Aliases.json`、`BlockData.json`、`Language.json`、`PluralRules.json`では文書化されたobject root)として出力され、利用可否は各ファイルのstateまたは`Manifest.json.capabilities`に記録されます。

## Manifest capabilities

`Manifest.json`はschema version 6を使用し、次の情報を記録します。
`Manifest.json`はschema version 7を使用し、次の情報を記録します。

- `syntaxApi`: `legacy-static`または`registry`
- `eventValueApi`: `legacy`、`modern-2.15`、または`modern-2.16`
Expand Down Expand Up @@ -66,24 +66,32 @@ schema 6では実装classとliteral性を保持し、context依存の初期化

補助registryと関係データ:

| Skript | Arithmetic | Converters | Comparators | Event values | Properties | Class hierarchy | Global aliases | Language registry | Plural rules |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2.6.4 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.7.3 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.8.7 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.9.5 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.10.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.11.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.12.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
| 2.13.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.14.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.15.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| 2.16.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Skript | Arithmetic | Converters | Comparators | Event values | Properties | Class hierarchy | Global aliases | Language registry | Plural rules | Block data |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2.6.4 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.7.3 | No | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.8.7 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.9.5 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.10.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.11.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.12.2 | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Runtime |
| 2.13.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.14.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.15.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |
| 2.16.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Runtime |

`Arithmetic`は、`Operators.json`、`Operations.json`、`Differences.json`を1つのcapabilityとして表します。 `Plural rules`は`PluralRules.json`を表し、対応する全Skript versionにbuilt-in変換tableがあります。addonがruntime overrideを先頭追加できるかは`pluralOverrideSupported`で判定します。Event valueはテスト済みの全バージョンで取得できますが、metadataの形状が異なります。2.6.4-2.14.3では`eventValueApi: legacy`、2.15.4と2.16.0では`modern-2.16`です。Skriptバージョンだけから推測せず、Manifestから実際に検出された形状を参照してください。

Skript 2.6.4には列挙可能なStructure registryがありません。command、function、options、variables、aliases、eventのトップレベル構造は、`ScriptLoader`内の専用分岐で処理されます。このGeneratorは構文宣言を再構築するのではなく、登録された生データを保存するため、これらを`Structures.json`へ擬似的に追加しません。

BlockDataはSkriptのversionだけでは決まりません。`BlockData.json.state`は、Minecraft 1.13以降では`collected`、1.12.2以前では`unsupported`、registryの検査に失敗した場合は`unresolved`です。

| Minecraft runtime | `BlockData.json.state` | 意味 |
| --- | --- | --- |
| 1.13以降 | `collected` | Bukkit/BlockState registryからハードコードなしで取得。 |
| 1.12.2以前 | `unsupported` | `org.bukkit.block.data.BlockData` APIが存在しない。 |
| 検査失敗 | `unresolved` | APIは期待されるが、registryを安全に読めない。 |

## 互換性マトリクス

integration suiteでは、現在次の境界をテストしています。
Expand Down
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ data class IntegrationProfile(
"Comparators.json",
"EventValues.json"
)
val minecraftParts = minecraft.split('.').mapNotNull(String::toIntOrNull)
if (
minecraftParts.firstOrNull()?.let { major ->
major > 1 || (major == 1 && (minecraftParts.getOrNull(1) ?: 0) >= 13)
} == true
) {
files += "BlockData.json"
}
val minor = skript.split(".").getOrNull(1)?.toIntOrNull() ?: return files
if (minor >= 7) files += "Structures.json"
if (minor >= 8) {
Expand Down
Loading