-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on adapter development documentation
- Loading branch information
Showing
10 changed files
with
199 additions
and
16 deletions.
There are no files selected for viewing
File renamed without changes.
106 changes: 106 additions & 0 deletions
106
documentation/docs/develop/02-adapters/02-getting_started.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,106 @@ | ||
--- | ||
title: Getting Started | ||
--- | ||
|
||
# Creating an Adapter | ||
## Introduction | ||
TypeWriter is a dynamic platform that supports the development of adapters, which are modular components enhancing the overall functionality. Adapters are self-contained, easily shareable, and integrate smoothly into the TypeWriter system. This guide is tailored to guide you through the process of creating an adapter, suitable for both beginners and experienced developers. | ||
|
||
## Prerequisites | ||
- Java Development Kit (JDK) 17 or higher. | ||
- An Integrated Development Environment (IDE) such as IntelliJ IDEA or Eclipse. | ||
- A basic understanding of Gradle and the Spigot API. | ||
|
||
## Step 1: Setting Up a Gradle Project | ||
Begin by establishing a Gradle project for your TypeWriter adapter. Below is a comprehensive setup for your `build.gradle.kts`: | ||
|
||
```kotlin title="build.gradle.kts" | ||
plugins { | ||
kotlin("jvm") version "1.8.20" | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
} | ||
|
||
// Replace with your own information | ||
group = "me.yourusername" | ||
version = "0.0.1" | ||
|
||
repositories { | ||
maven("https://jitpack.io") | ||
mavenCentral() | ||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") | ||
maven("https://oss.sonatype.org/content/groups/public/") | ||
maven("https://libraries.minecraft.net/") | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
maven("https://repo.codemc.io/repository/maven-snapshots/") | ||
maven("https://repo.opencollab.dev/maven-snapshots/") | ||
|
||
// Add other necessary repositories | ||
} | ||
|
||
dependencies { | ||
compileOnly(kotlin("stdlib")) | ||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") | ||
compileOnly("com.github.gabber235:typewriter:main-SNAPSHOT") // Latest release version | ||
|
||
// Already included in the TypeWriter plugin but still needed for compilation | ||
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC") | ||
compileOnly("com.github.dyam0:LirandAPI:96cc59d4fb") | ||
compileOnly("net.kyori:adventure-api:4.13.1") | ||
compileOnly("net.kyori:adventure-text-minimessage:4.13.1") | ||
|
||
// Add other dependencies as needed | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
``` | ||
|
||
Ensure to replace placeholders like `me.yourusername` with your project details. | ||
|
||
### Choosing the TypeWriter Version | ||
Select the appropriate TypeWriter dependency version: | ||
For stable and tested features, use the latest release version: | ||
```kotlin | ||
compileOnly("com.github.gabber235:typewriter:main-SNAPSHOT") | ||
``` | ||
This is suitable for most development needs and is recommended for general adapter creation. | ||
|
||
If you need the latest features and improvements (which might be unstable), use the latest development version: | ||
```kotlin | ||
compileOnly("com.github.gabber235:typewriter:develop-SNAPSHOT") | ||
``` | ||
Note that this version may include changes that are not yet fully tested or documented. | ||
|
||
If you need a specific version, visit the [JitPack page](https://jitpack.io/#gabber235/typewriter) and select the version you need. | ||
|
||
## Step 2: Creating an Adapter Class | ||
After setting up your project, create an adapter class. Here's an example: | ||
kotlin title="ExampleAdapter.kt" | ||
```kotlin | ||
import me.gabber235.typewriter.adapters.Adapter | ||
import me.gabber235.typewriter.adapters.TypewriteAdapter | ||
|
||
@Adapter("Example", "An example adapter for documentation purposes", "0.0.1") | ||
object ExampleAdapter : TypewriteAdapter() { | ||
override fun initialize() { | ||
// Any initializations needed to run the adapter. | ||
} | ||
} | ||
``` | ||
|
||
|
||
## Step 3: Building the Adapter | ||
After creating the adapter class, build the adapter. This can be done by running the `shadowJar` Gradle task. | ||
This will generate a JAR file in the `build/libs` directory. | ||
This JAR file can be used as an adapter in TypeWriter. | ||
Place the JAR file in the `plugins/TypeWriter/adapters` directory and restart the server. | ||
Typewriter will automatically load the adapter and run it. | ||
|
||
If any problems occur, check the console for errors and ensure that the adapter is properly configured. | ||
If you need help, join the [Discord server](https://discord.gg/HtbKyuDDBw) and ask for help. | ||
|
||
## What's Next? | ||
After creating an adapter, you can start adding features to it. | ||
Check out the [Creating Entries](creating-entries) guide to learn how to add entries to your adapter. |
44 changes: 44 additions & 0 deletions
44
documentation/docs/develop/02-adapters/03-entries/index.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,44 @@ | ||
# Create Entries | ||
Creating adapters for the TypeWriter Spigot plugin involves working with various entry types, each serving a specific | ||
purpose in crafting immersive player experiences. | ||
This documentation explains the roles and functionalities of these entry types, providing clear guidance for developers on how to effectively use them. | ||
|
||
## Base Entry Interfaces | ||
There are three base interfaces that all entries extend atleast one of. These are: | ||
1. **StaticEntry**: Represents static pages. These are used for content that does not change dynamically or trigger any actions. Examples include static text or images. | ||
2. **TriggerEntry**: Designed for entries that initiate other actions or events. These entries can trigger one or more additional entries, making them crucial for interactive sequences. | ||
3. **CinematicEntry**: Used for cinematic experiences. These entries are ideal for creating immersive story-driven sequences that engage players in a more visually dynamic way. | ||
|
||
|
||
### 1. StaticEntry | ||
- **AssetEntry**: Handles external assets, like images or files. | ||
- **ArtifactEntry**: Manages plugin-generated assets, such as JSON files. | ||
- **EntityEntry**: Serves as a base for static entities in the game. | ||
- **SpeakerEntry**: Extends EntityEntry for entities capable of speaking, with defined display names and sounds. | ||
- **FactEntry**: Represents static facts or data points. | ||
- **SoundIdEntry**: Holds identifiers for specific sounds. | ||
- **SoundSourceEntry**: Deals with the sources of sound emissions. | ||
|
||
### 2. TriggerEntry | ||
- **EventEntry**: A base for entries that are event-driven. | ||
- **CustomCommandEntry**: Extends EventEntry to allow for the creation of custom in-game commands. | ||
|
||
#### 2a. TriggerableEntry (an extension of TriggerEntry) | ||
These are entries that can be triggered by other entries. They are the most common type of entry, and are used for creating interactive sequences. | ||
- **DialogueEntry**: Specialized for dialogues with specific speakers, enhancing NPC interactions. | ||
- **ActionEntry**: Executes actions based on player interactions, capable of modifying facts or triggering events. | ||
- **CustomTriggeringActionEntry**: A variant of ActionEntry, allowing for custom trigger mechanisms and manual triggering of actions. | ||
|
||
### 3. CinematicEntry | ||
- Primarily used for crafting cinematic experiences in-game, this base interface doesn't have listed specialized interfaces, but it's pivotal for creating story-driven, visually dynamic sequences. | ||
|
||
|
||
## Implementation and Usage | ||
Each interface is designed with specific tags and methods to facilitate unique interactions within the TypeWriter plugin. | ||
Implementing these interfaces allows developers to craft a wide range of player experiences, from simple static displays to complex, multi-step interactive quests and dialogues. | ||
|
||
For instance, a TriggerableEntry can be used to set up a quest that only activates under certain conditions, while a DialogueEntry can bring an NPC to life with personalized dialogues. | ||
Similarly, an ActionEntry can be used to create dynamic effects that change based on player actions, and a CinematicEntry can be used to create a visually dynamic story sequence. | ||
|
||
In summary, these entry interfaces form the backbone of the TypeWriter plugin's functionality, offering a robust framework for creating immersive and interactive content within Minecraft. | ||
By understanding and utilizing these interfaces, developers can greatly enhance the player experience, making it more engaging and dynamic. |
1 change: 1 addition & 0 deletions
1
documentation/docs/develop/02-adapters/03-entries/static/_category_.yml
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 @@ | ||
label: Static Entries |
20 changes: 20 additions & 0 deletions
20
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# AssetEntry | ||
The AssetEntry is a specialized interface that extends the StaticEntry in the TypeWriter Spigot plugin. | ||
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 | ||
```kotlin | ||
@Entry("example_asset", "An example asset entry.", Colors.PINK, Icons.PERSON_WALKING) | ||
class ExampleAssetEntry( | ||
override val path: String = "", | ||
): AssetEntry | ||
``` | ||
|
||
To get the asset from the entry, you can use the following code: | ||
```kotlin | ||
val id = // ID of the entry | ||
val entry = Query.findById<ExampleAssetEntry>(id) | ||
val path = entry.path | ||
``` |
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,10 @@ | ||
# Adapters | ||
## Introduction | ||
TypeWriter is a dynamic platform that supports the development of adapters, which are modular components enhancing the overall functionality. Adapters are self-contained, easily shareable, and integrate smoothly into the TypeWriter system. This guide is tailored to guide you through the process of creating an adapter, suitable for both beginners and experienced developers. | ||
|
||
:::info | ||
It is highly recommended to write adapters in Kotlin, as it is the primary language of TypeWriter. However, it is also possible to write adapters in Java, as long as the adapter is compiled into a `.jar` file. | ||
::: | ||
|
||
## Guides | ||
- [Getting Started](getting-started) |
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
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