-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
documentation/docs/develop/02-adapters/03-entries/static/artifact.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# ArtifactEntry | ||
|
||
The `ArtifactEntry` is a specialized interface derived from `AssetEntry`. | ||
Its primary purpose is to handle artifacts, which are assets generated by the plugins/adapters itself. | ||
Unlike standard assets, artifacts are usually dynamic and created during runtime. | ||
This makes them particularly useful for storing data that changes based on player interactions or game events. | ||
|
||
An essential feature of `ArtifactEntry` is its unique `artifactId`. | ||
This identifier must remain constant once assigned and is used to reference the artifact within the plugin. | ||
|
||
## Usage | ||
|
||
Here's a generic example of creating and using an `ArtifactEntry`: | ||
|
||
### Defining an ArtifactEntry | ||
|
||
```kotlin | ||
@Entry("example_artifact", "An example artifact entry.", Colors.BLUE, Icons.ARROW) | ||
class ExampleArtifactEntry( | ||
override val id: String = "", | ||
override val name: String = "", | ||
override val artifactId: String = "", | ||
) : ArtifactEntry | ||
``` | ||
|
||
### Accessing the Artifact's Content | ||
```kotlin | ||
import org.koin.java.KoinJavaComponent.get | ||
|
||
val assetManager = get<AssetManager>(AssetManager::class.java) | ||
|
||
val id = // ID of the entry | ||
val entry = Query.findById<ExampleArtifactEntry>(id) | ||
val content: String = assetManager.fetchAsset(entry) | ||
``` | ||
|
||
In this example, `ExampleArtifactEntry` is defined as an artifact with a unique identifier. The `assetManager.fetchAsset` method is then used to retrieve the content of the artifact, based on its `artifactId`. | ||
|
13 changes: 11 additions & 2 deletions
13
documentation/docs/develop/02-adapters/03-entries/static/asset.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
# AssetEntry | ||
The AssetEntry is a specialized interface that extends the StaticEntry in the TypeWriter Spigot plugin. | ||
The AssetEntry is a specialized interface that extends the `StaticEntry`. | ||
It is primarily used for handling static assets within the game. | ||
Assets can include various types of files such as images, sounds, or other external resources that are crucial to enhancing the game environment and player experience. | ||
The key attribute of AssetEntry is the path, which specifies the location of the asset. | ||
|
||
## Usage | ||
Here's a generic example of creating and using an `AssetEntry`: | ||
|
||
### Defining an AssetEntry | ||
```kotlin | ||
@Entry("example_asset", "An example asset entry.", Colors.PINK, Icons.PERSON_WALKING) | ||
class ExampleAssetEntry( | ||
override val path: String = "", | ||
): AssetEntry | ||
``` | ||
|
||
### Accessing the Artifact's Content | ||
|
||
To get the asset from the entry, you can use the following code: | ||
```kotlin | ||
import org.koin.java.KoinJavaComponent.get | ||
|
||
val assetManager = get<AssetManager>(AssetManager::class.java) | ||
|
||
val id = // ID of the entry | ||
val entry = Query.findById<ExampleAssetEntry>(id) | ||
val path = entry.path | ||
val content: String = assetManager.fetchAsset(entry) | ||
``` |
23 changes: 23 additions & 0 deletions
23
documentation/docs/develop/02-adapters/03-entries/static/sound_id.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SoundIdEntry | ||
|
||
The `SoundIdEntry` is an interface derived from `StaticEntry`, specifically designed for managing custom sounds within the TypeWriter Spigot plugin. | ||
If a server is using a custom resource pack, the `SoundIdEntry` can be used to add a reference to a custom sound within the resource pack. | ||
|
||
## Usage | ||
```kotlin | ||
@Entry("example_sound", "An example sound entry.", Colors.GREEN, Icons.VOLUME_HIGH) | ||
class ExampleSoundIdEntry( | ||
override val id: String, | ||
override val name: String, | ||
override val soundId: String, | ||
) : SoundIdEntry | ||
``` | ||
|
||
Normally a `SoundIdEntry` handled by the interface when an entry needs a sound. | ||
If you ever would need to access the sound ID directly, it can be done like this: | ||
|
||
```kotlin | ||
val id = // ID of the custom sound | ||
val entry = Query.findById<ExampleSoundIdEntry>(id) | ||
val customSound = entry.soundId | ||
``` |
27 changes: 27 additions & 0 deletions
27
documentation/docs/develop/02-adapters/03-entries/static/speaker.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SpeakerEntry | ||
|
||
The `SpeakerEntry` is a specialized interface extending the `EntityEntry`. | ||
It is designed to enhance dialogues in the game by associating non-player characters (NPCs) with specific names and sounds. | ||
This feature is pivotal for creating more immersive and interactive storytelling experiences in Minecraft. | ||
|
||
## Usage | ||
```kotlin | ||
@Entry("example_speaker", "An example speaker entry.", Colors.BLUE, Icons.PERSON_TALKING) | ||
class ExampleSpeakerEntry( | ||
override val id: String = "", | ||
override val name: String = "", | ||
override val displayName: String = "", | ||
override val sound: Sound = Sound.EMPTY, | ||
) : SpeakerEntry | ||
``` | ||
|
||
This speaker can be used by users in various dialogues and interactions within the game. | ||
Normally, you never need to access the `SpeakerEntry` directly, as it is automatically handled by the `DialogueSequence`. | ||
If you ever do need to access the `SpeakerEntry`, you can do so: | ||
|
||
```kotlin | ||
val id = // ID of the speaker | ||
val entry = Query.findById<ExampleSpeakerEntry>(id) | ||
val name = entry.displayName | ||
val sound = entry.sound | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters