Skip to main content
 Warning: Beta Version
Version: Beta ⚠️

Creating an Extension

Introduction

Typewriter is a dynamic platform that supports the development of extensions, which are modular components enhancing the overall functionality. Extensions are self-contained, easily shareable, and integrate smoothly into the TypeWriter system. They allow you to create custom entries and have them show up in the web panel. This guide is tailored to guide you through the process of creating an extension.

Prerequisites

  • Java Development Kit (JDK) 21 or higher.
  • An Integrated Development Environment (IDE) such as IntelliJ IDEA or Eclipse.
  • A basic understanding of Gradle and the Spigot API.

Setting Up a Gradle Project

Begin by establishing a Gradle project for your Typewriter extension. Below is a comprehensive setup for your Gradle project:

Add the following to your settings.gradle.kts file:

settings.gradle.kts
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.typewritermc.com/releases")
}
}

Add the following to your build.gradle.kts file:

build.gradle.kts
plugins {
kotlin("jvm") version "2.0.20"
id("com.typewritermc.module-plugin") version "<module plugin version>"
}

// Replace with your own information
group = "me.yourusername"
version = "0.0.1"

typewriter {
engine {
version = "<latest typewriter version>"
}
namespace = "<a name for the company which all your extensions are published under>"

extension {
name = "<Name of the extension>"
shortDescription = "<Short description of the extension>"
description = "<Long description of the extension>"

paper {
// Optional - If you want to make sure a plugin is required to be installed to use this extension
dependency("<plugin name>")
}
}
}

kotlin {
jvmToolchain(21)
}
 Replace your information

Ensure to replace placeholders like me.yourusername with your project details.

Building the Extension

After creating the extension class, build the extension. This can be done by running the build Gradle task. This will generate a JAR file in the build/libs directory. This JAR file can be used as an extension in TypeWriter. Place the JAR file in the plugins/TypeWriter/extensions directory. Typewriter will automatically load the extension and run it.

 Reloading Extensions

You can either restart the Minecraft server or reload Typewriter with /typewriter reload to reload the extensions.

If any problems occur, check the console for errors and ensure that the extension is properly configured. If you need help, join the Discord server and ask for help.

What's Next?

After creating an extension, you can start adding features to it. Check out the Creating Entries guide to learn how to add entries to your extension.