diff --git a/documentation/docusaurus.config.js b/documentation/docusaurus.config.js index f067d5a80c..22999f3b2f 100644 --- a/documentation/docusaurus.config.js +++ b/documentation/docusaurus.config.js @@ -235,7 +235,14 @@ const config = { require.resolve("./plugins/code-snippets/index.js"), ], future: { - experimental_faster: true, + experimental_faster: { + swcJsLoader: true, + swcJsMinimizer: true, + swcHtmlMinimizer: true, + lightningCssMinimizer: true, + rspackBundler: false, + mdxCrossCompilerCache: true, + }, }, }; diff --git a/documentation/package-lock.json b/documentation/package-lock.json index 6fca2106d0..060e22886e 100644 --- a/documentation/package-lock.json +++ b/documentation/package-lock.json @@ -14,7 +14,7 @@ "@docusaurus/preset-classic": "^3.6.1", "@docusaurus/theme-mermaid": "^3.6.1", "@mdx-js/react": "^3.1.0", - "@rive-app/react-canvas": "^4.16.0", + "@rive-app/react-canvas": "^4.16.4", "clsx": "^2.1.1", "documentation": "file:", "posthog-docusaurus": "^2.0.1", @@ -34,10 +34,10 @@ "@iconify/react": "^5.0.2", "@types/react": "^18.3.12", "autoprefixer": "^10.4.20", - "postcss": "^8.4.41", + "postcss": "^8.4.49", "responsive-loader": "^3.1.2", "sharp": "^0.33.5", - "tailwindcss": "^3.4.14", + "tailwindcss": "^3.4.15", "typescript": "^5.6.3" }, "engines": { @@ -3903,18 +3903,18 @@ } }, "node_modules/@rive-app/canvas": { - "version": "2.23.4", - "resolved": "https://registry.npmjs.org/@rive-app/canvas/-/canvas-2.23.4.tgz", - "integrity": "sha512-Hm9HtkTQwWwLEDqF12zXD0IqnC87Lw8fZNaWJFvB+LEzrlLH3jGjTszdm1obJN3lA3Z9meXo3dmgFQSL7rRqgA==", + "version": "2.23.8", + "resolved": "https://registry.npmjs.org/@rive-app/canvas/-/canvas-2.23.8.tgz", + "integrity": "sha512-cs65ihcRVO8LeBssXtajxiDuuQnscHYWhikNV9BU2SQwWNzHPirrzjddM/MlMbSFUpd+oOYW5aZx1I11YHmnfQ==", "license": "MIT" }, "node_modules/@rive-app/react-canvas": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/@rive-app/react-canvas/-/react-canvas-4.16.1.tgz", - "integrity": "sha512-MFTXvaTetAiJ0v3mN39CmWL/YxxDvTqhPzw1XCpVGN7F+NehEzasN5hdbDtH8RYVl8n8b39dX1KF3n/YT0aTPg==", + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/@rive-app/react-canvas/-/react-canvas-4.16.4.tgz", + "integrity": "sha512-vjsWcfAH+Ngqu/4kGA7KR+sM8dk16im84FVu2znssV1Ev9Y0cWJWevMQq5oNaBi5zWkXc8D9xwvv51e6zDp2qA==", "license": "MIT", "dependencies": { - "@rive-app/canvas": "2.23.4" + "@rive-app/canvas": "2.23.8" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -15398,9 +15398,9 @@ } }, "node_modules/postcss": { - "version": "8.4.41", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz", - "integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==", + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", "funding": [ { "type": "opencollective", @@ -15418,8 +15418,8 @@ "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -16029,9 +16029,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz", - "integrity": "sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", "license": "MIT", "dependencies": { "cssesc": "^3.0.0", @@ -18281,9 +18281,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -18745,34 +18745,34 @@ } }, "node_modules/tailwindcss": { - "version": "3.4.14", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.14.tgz", - "integrity": "sha512-IcSvOcTRcUtQQ7ILQL5quRDg7Xs93PdJEk1ZLbhhvJc7uj/OAhYOnruEiwnGgBvUtaUAJ8/mhSw1o8L2jCiENA==", + "version": "3.4.15", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.15.tgz", + "integrity": "sha512-r4MeXnfBmSOuKUWmXe6h2CcyfzJCEk4F0pptO5jlnYSIViUkVmsawj80N5h2lO3gwcmSb4n3PuN+e+GC1Guylw==", "dev": true, "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.3.0", + "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.21.0", + "jiti": "^1.21.6", "lilconfig": "^2.1.0", - "micromatch": "^4.0.5", + "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", - "picocolors": "^1.0.0", - "postcss": "^8.4.23", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", - "postcss-load-config": "^4.0.1", - "postcss-nested": "^6.0.1", - "postcss-selector-parser": "^6.0.11", - "resolve": "^1.22.2", - "sucrase": "^3.32.0" + "postcss-load-config": "^4.0.2", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", diff --git a/documentation/package.json b/documentation/package.json index 940950a8e9..c37d6cd90b 100644 --- a/documentation/package.json +++ b/documentation/package.json @@ -21,7 +21,7 @@ "@docusaurus/preset-classic": "^3.6.1", "@docusaurus/theme-mermaid": "^3.6.1", "@mdx-js/react": "^3.1.0", - "@rive-app/react-canvas": "^4.16.0", + "@rive-app/react-canvas": "^4.16.4", "clsx": "^2.1.1", "documentation": "file:", "posthog-docusaurus": "^2.0.1", @@ -41,10 +41,10 @@ "@iconify/react": "^5.0.2", "@types/react": "^18.3.12", "autoprefixer": "^10.4.20", - "postcss": "^8.4.41", + "postcss": "^8.4.49", "responsive-loader": "^3.1.2", "sharp": "^0.33.5", - "tailwindcss": "^3.4.14", + "tailwindcss": "^3.4.15", "typescript": "^5.6.3" }, "browserslist": { diff --git a/documentation/plugins/code-snippets/snippets.json b/documentation/plugins/code-snippets/snippets.json index 78df2752d3..79a2c73ae2 100644 --- a/documentation/plugins/code-snippets/snippets.json +++ b/documentation/plugins/code-snippets/snippets.json @@ -1,118 +1,118 @@ { - "initializer": { - "file": "src/main/kotlin/com/typewritermc/example/ExampleInitializer.kt", - "content": "import com.typewritermc.core.extension.Initializable\nimport com.typewritermc.core.extension.annotations.Initializer\n\n@Initializer\nobject ExampleInitializer : Initializable {\n override fun initialize() {\n // Do something when the extension is initialized\n }\n\n override fun shutdown() {\n // Do something when the extension is shutdown\n }\n}" - }, "cinematic_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": "@Entry(\"example_cinematic\", \"An example cinematic entry\", Colors.BLUE, \"material-symbols:cinematic-blur\")\nclass ExampleCinematicEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val criteria: List = emptyList(),\n @Segments(Colors.BLUE, \"material-symbols:cinematic-blur\")\n val segments: List = emptyList(),\n) : CinematicEntry {\n override fun create(player: Player): CinematicAction {\n return ExampleCinematicAction(player, this)\n }\n}" }, "cinematic_segment_with_min_max": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": " @Segments(Colors.BLUE, \"material-symbols:cinematic-blur\")\n @InnerMin(Min(10))\n @InnerMax(Max(20))\n val segments: List = emptyList()," }, "cinematic_create_actions": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": " // This will be used when the cinematic is normally displayed to the player.\n override fun create(player: Player): CinematicAction {\n return DefaultCinematicAction(player, this)\n }\n\n // This is used during content mode to display the cinematic to the player.\n // It may be null to not show it during simulation.\n override fun createSimulating(player: Player): CinematicAction? {\n return SimulatedCinematicAction(player, this)\n }\n\n // This is used during content mode to record the cinematic.\n // It may be null to not record it during simulation.\n override fun createRecording(player: Player): CinematicAction? {\n return RecordingCinematicAction(player, this)\n }" }, "cinematic_segment": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": "data class ExampleSegment(\n override val startFrame: Int = 0,\n override val endFrame: Int = 0,\n) : Segment" }, "cinematic_action": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": "class ExampleCinematicAction(\n val player: Player,\n val entry: ExampleCinematicEntry,\n) : CinematicAction {\n override suspend fun setup() {\n // Initialize variables, spawn entities, etc.\n }\n\n override suspend fun tick(frame: Int) {\n val segment = entry.segments activeSegmentAt frame\n // Can be null if no segment is active\n\n // The `frame` parameter is not necessarily next frame: `frame != old(frame)+1`\n\n // Execute tick logic for the segment\n }\n\n override suspend fun teardown() {\n // Remove entities, etc.\n }\n\n override fun canFinish(frame: Int): Boolean = entry.segments canFinishAt frame\n}" }, "cinematic_simple_action": { - "file": "src/main/kotlin/com/typewritermc/example/entries/cinematic/ExampleCinematicEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\cinematic\\ExampleCinematicEntry.kt", "content": "class ExampleSimpleCinematicAction(\n val player: Player,\n entry: ExampleCinematicEntry,\n) : SimpleCinematicAction() {\n override val segments: List = entry.segments\n\n override suspend fun startSegment(segment: ExampleSegment) {\n super.startSegment(segment) // Keep this\n // Called when a segment starts\n }\n\n override suspend fun tickSegment(segment: ExampleSegment, frame: Int) {\n super.tickSegment(segment, frame) // Keep this\n // Called every tick while the segment is active\n // Will always be called after startSegment and never after stopSegment\n\n // The `frame` parameter is not necessarily next frame: `frame != old(frame)+1`\n }\n\n override suspend fun stopSegment(segment: ExampleSegment) {\n super.stopSegment(segment) // Keep this\n // Called when the segment ends\n // Will also be called if the cinematic is stopped early\n }\n}" }, "audience_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/manifest/ExampleAudienceEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\manifest\\ExampleAudienceEntry.kt", "content": "@Entry(\"example_audience\", \"An example audience entry.\", Colors.GREEN, \"material-symbols:chat-rounded\")\nclass ExampleAudienceEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n) : AudienceEntry {\n override fun display(): AudienceDisplay {\n return ExampleAudienceDisplay()\n }\n}" }, "audience_display": { - "file": "src/main/kotlin/com/typewritermc/example/entries/manifest/ExampleAudienceEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\manifest\\ExampleAudienceEntry.kt", "content": "class ExampleAudienceDisplay : AudienceDisplay() {\n override fun initialize() {\n // This is called when the first player is added to the audience.\n super.initialize()\n // Do something when the audience is initialized\n }\n\n override fun onPlayerAdd(player: Player) {\n // Do something when a player gets added to the audience\n }\n\n override fun onPlayerRemove(player: Player) {\n // Do something when a player gets removed from the audience\n }\n\n override fun dispose() {\n super.dispose()\n // Do something when the audience is disposed\n // It will always call onPlayerRemove for all players.\n // So no player cleanup is needed here.\n }\n}" }, "tickable_audience_display": { - "file": "src/main/kotlin/com/typewritermc/example/entries/manifest/ExampleAudienceEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\manifest\\ExampleAudienceEntry.kt", "content": "// highlight-next-line\nclass TickableAudienceDisplay : AudienceDisplay(), TickableDisplay {\n override fun onPlayerAdd(player: Player) {}\n override fun onPlayerRemove(player: Player) {}\n\n // highlight-start\n override fun tick() {\n // Do something when the audience is ticked\n players.forEach { player ->\n // Do something with the player\n }\n\n // This is running asynchronously\n // If you need to do something on the main thread\n ThreadType.SYNC.launch {\n // Though this will run a tick later, to sync with the bukkit scheduler.\n }\n }\n // highlight-end\n}" }, "audience_display_with_events": { - "file": "src/main/kotlin/com/typewritermc/example/entries/manifest/ExampleAudienceEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\manifest\\ExampleAudienceEntry.kt", "content": "class AudienceDisplayWithEvents : AudienceDisplay() {\n override fun onPlayerAdd(player: Player) {}\n override fun onPlayerRemove(player: Player) {}\n\n // highlight-start\n @EventHandler\n fun onSomeEvent(event: SomeBukkitEvent) {\n // Do something when the event is triggered\n // This will trigger for all players, not just the ones in the audience.\n // So we need to check if the player is in the audience.\n if (event.player in this) {\n // Do something with the player\n }\n }\n // highlight-end\n}" }, "artifact_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleArtifactEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleArtifactEntry.kt", "content": "@Entry(\"example_artifact\", \"An example artifact entry.\", Colors.BLUE, \"material-symbols:home-storage-rounded\")\nclass ExampleArtifactEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val artifactId: String = \"\",\n) : ArtifactEntry" }, "artifact_access": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleArtifactEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleArtifactEntry.kt", "content": "suspend fun accessArtifactData(ref: Ref) {\n val assetManager = KoinJavaComponent.get(AssetManager::class.java)\n val entry = ref.get() ?: return\n val content: String? = assetManager.fetchAsset(entry)\n // Do something with the content\n}" }, "asset_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleAssetEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleAssetEntry.kt", "content": "@Entry(\"example_asset\", \"An example asset entry.\", Colors.BLUE, \"material-symbols:home-storage-rounded\")\nclass ExampleAssetEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val path: String = \"\",\n) : AssetEntry" }, "asset_access": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleAssetEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleAssetEntry.kt", "content": "suspend fun accessAssetData(ref: Ref) {\n val assetManager = KoinJavaComponent.get(AssetManager::class.java)\n val entry = ref.get() ?: return\n val content: String? = assetManager.fetchAsset(entry)\n // Do something with the content\n}" }, "sound_id_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleSoundIdEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleSoundIdEntry.kt", "content": "@Entry(\"example_sound\", \"An example sound entry.\", Colors.BLUE, \"icon-park-solid:volume-up\")\nclass ExampleSoundIdEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val soundId: String = \"\",\n) : SoundIdEntry" }, "sound_source_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleSoundSourceEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleSoundSourceEntry.kt", "content": "@Entry(\"example_sound_source\", \"An example sound source entry.\", Colors.BLUE, \"ic:round-spatial-audio-off\")\nclass ExampleSoundSourceEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n) : SoundSourceEntry {\n override fun getEmitter(player: Player): SoundEmitter {\n // Return the emitter that should be used for the sound.\n // An entity should be provided.\n return SoundEmitter(player.entityId)\n }\n}" }, "speaker_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleSpeakerEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleSpeakerEntry.kt", "content": "@Entry(\"example_speaker\", \"An example speaker entry.\", Colors.BLUE, \"ic:round-spatial-audio-off\")\nclass ExampleSpeakerEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val displayName: Var = ConstVar(\"\"),\n override val sound: Sound = Sound.EMPTY,\n) : SpeakerEntry" }, "variable_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleVariableEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleVariableEntry.kt", "content": "@Entry(\"example_variable\", \"An example variable entry.\", Colors.GREEN, \"mdi:code-tags\")\nclass ExampleVariableEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n) : VariableEntry {\n override fun get(context: VarContext): T {\n val player = context.player\n val klass = context.klass\n\n TODO(\"Do something with the player and the klass\")\n }\n}" }, "variable_entry_with_data": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleVariableEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleVariableEntry.kt", "content": "@Entry(\"example_variable_with_data\", \"An example variable entry with data.\", Colors.GREEN, \"mdi:code-tags\")\n// Register the variable data associated with this variable.\n@VariableData(ExampleVariableWithData::class)\nclass ExampleVariableWithDataEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n // This data will be the same for all uses of this variable.\n val someString: String = \"\",\n) : VariableEntry {\n override fun get(context: VarContext): T {\n val player = context.player\n val klass = context.klass\n this.someString\n val data = context.getData() ?: throw IllegalStateException(\"Could not find data for ${context.klass}, data: ${context.data}\")\n\n TODO(\"Do something with the player, the klass, and the data\")\n }\n}\n\nclass ExampleVariableWithData(\n // This data can change at the place where the variable is used.\n val otherInfo: Int = 0,\n)" }, "generic_variable_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleVariableEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleVariableEntry.kt", "content": "@Entry(\"example_generic_variable\", \"An example generic variable entry.\", Colors.GREEN, \"mdi:code-tags\")\nclass ExampleGenericVariableEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n // We determine how to parse this during runtime.\n val generic: Generic = Generic.Empty,\n) : VariableEntry {\n override fun get(context: VarContext): T {\n val player = context.player\n val klass = context.klass\n\n // Parse the generic data to the correct type.\n val data = generic.get(klass)\n\n TODO(\"Do something with the player, the klass, and the generic\")\n }\n}\n\nclass ExampleGenericVariableData(\n // Generic data will always be the same as the generic type in the variable.\n val otherGeneric: Generic,\n)" }, "constraint_variable_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleVariableEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleVariableEntry.kt", "content": "@Entry(\"example_constraint_variable\", \"An example constraint variable entry.\", Colors.GREEN, \"mdi:code-tags\")\n@GenericConstraint(String::class)\n@GenericConstraint(Int::class)\nclass ExampleConstraintVariableEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n // We determine how to parse this during runtime.\n val generic: Generic = Generic.Empty,\n) : VariableEntry {\n override fun get(context: VarContext): T {\n val player = context.player\n // This can only be a String or an Int.\n val klass = context.klass\n\n // Parse the generic data to the correct type.\n val data = generic.get(klass)\n\n TODO(\"Do something with the player, the klass, and the generic\")\n }\n}" }, "variable_usage": { - "file": "src/main/kotlin/com/typewritermc/example/entries/static/ExampleVariableEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\static\\ExampleVariableEntry.kt", "content": "@Entry(\"example_action_using_variable\", \"An example action that uses a variable.\", Colors.RED, \"material-symbols:touch-app-rounded\")\nclass ExampleActionUsingVariableEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val triggers: List> = emptyList(),\n override val criteria: List = emptyList(),\n override val modifiers: List = emptyList(),\n val someString: Var = ConstVar(\"\"),\n val someInt: Var = ConstVar(0),\n) : ActionEntry {\n override fun execute(player: Player) {\n val someString = someString.get(player)\n val someInt = someInt.get(player)\n\n // Do something with the variables\n }\n}" }, "action_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleActionEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleActionEntry.kt", "content": "@Entry(\"example_action\", \"An example action entry.\", Colors.RED, \"material-symbols:touch-app-rounded\")\nclass ExampleActionEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val criteria: List = emptyList(),\n override val modifiers: List = emptyList(),\n override val triggers: List> = emptyList(),\n) : ActionEntry {\n override fun execute(player: Player) {\n super.execute(player) // This will apply all the modifiers.\n // Do something with the player\n }\n}" }, "custom_triggering_action_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleCustomTriggeringActionEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleCustomTriggeringActionEntry.kt", "content": "@Entry(\n \"example_custom_triggering_action\",\n \"An example custom triggering entry.\",\n Colors.RED,\n \"material-symbols:touch-app-rounded\"\n)\nclass ExampleCustomTriggeringActionEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val criteria: List = emptyList(),\n override val modifiers: List = emptyList(),\n @SerializedName(\"triggers\")\n override val customTriggers: List> = emptyList(),\n) : CustomTriggeringActionEntry {\n override fun execute(player: Player) {\n super.execute(player) // This will apply the modifiers.\n // Do something with the player\n player.triggerCustomTriggers() // Can be called later to trigger the next entries.\n }\n}" }, "dialogue_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleDialogueEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleDialogueEntry.kt", "content": "@Entry(\"example_dialogue\", \"An example dialogue entry.\", Colors.BLUE, \"material-symbols:chat-rounded\")\nclass ExampleDialogueEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val criteria: List = emptyList(),\n override val modifiers: List = emptyList(),\n override val triggers: List> = emptyList(),\n override val speaker: Ref = emptyRef(),\n @MultiLine\n @Placeholder\n @Colored\n @Help(\"The text to display to the player.\")\n val text: String = \"\",\n) : DialogueEntry" }, "dialogue_messenger": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleDialogueEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleDialogueEntry.kt", "content": "@Messenger(ExampleDialogueEntry::class)\nclass ExampleDialogueDialogueMessenger(player: Player, entry: ExampleDialogueEntry) :\n DialogueMessenger(player, entry) {\n\n companion object : MessengerFilter {\n override fun filter(player: Player, entry: DialogueEntry): Boolean = true\n }\n\n // Called every game tick (20 times per second).\n // The cycle is a parameter that is incremented every tick, starting at 0.\n override fun tick(context: TickContext) {\n super.tick(context)\n if (state != MessengerState.RUNNING) return\n\n player.sendMessage(\"${entry.speakerDisplayName}: ${entry.text}\".parsePlaceholders(player).asMini())\n\n // When we want the dialogue to end, we can set the state to FINISHED.\n state = MessengerState.FINISHED\n }\n}" }, "event_entry": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleEventEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleEventEntry.kt", "content": "@Entry(\"example_event\", \"An example event entry.\", Colors.YELLOW, \"material-symbols:bigtop-updates\")\nclass ExampleEventEntry(\n override val id: String = \"\",\n override val name: String = \"\",\n override val triggers: List> = emptyList(),\n) : EventEntry" }, "event_entry_listener": { - "file": "src/main/kotlin/com/typewritermc/example/entries/trigger/ExampleEventEntry.kt", + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\entries\\trigger\\ExampleEventEntry.kt", "content": "// Must be scoped to be public\n@EntryListener(ExampleEventEntry::class)\nfun onEvent(event: SomeBukkitEvent, query: Query) {\n // Do something\n val entries = query.find() // Find all the entries of this type, for more information see the Query section\n // Do something with the entries, for example trigger them\n entries triggerAllFor event.player\n}" + }, + "initializer": { + "file": "src\\main\\kotlin\\com\\typewritermc\\example\\ExampleInitializer.kt", + "content": "import com.typewritermc.core.extension.Initializable\nimport com.typewritermc.core.extension.annotations.Initializer\n\n@Initializer\nobject ExampleInitializer : Initializable {\n override fun initialize() {\n // Do something when the extension is initialized\n }\n\n override fun shutdown() {\n // Do something when the extension is shutdown\n }\n}" } } \ No newline at end of file