This is a Minecraft Multiplatform template that provides architecture and various tools you'll need to create new Spigot/Velocity/Fabric/Forge server-plugins as fast as possible
This project can be very difficult for novice developers. Especially for those who were working with java.
AstraTemplate and it's libs design after more than 3 years of developing spigot plugins and android applications. It contains powerful and scalable architecture template which will help in your development.
├── modules
│ ├── api-local # Local api with runtime reloadable SQLite
│ ├── api-remote # Remote sample RickMorty API
│ ├── build-konfig # Compile-time constants
│ └── core # Core multiplatform module
├── instances
│ ├── bukkit # Paper API plugin
│ ├── forge # Forge server mod
│ ├── fabric # Fabric server mod
└── └── velocity # Velocity plugin
Build convention is great, but it's a lot of boilerplate when you have different projects.
Because of this I've made a decision to implement my gradle plugin into AstraTemplate
My gradle plugin is well-documented and easy to use. Please, see it
This module contains local API with sqlite database. It's Jvm only. Due to this factor, you can easily share this module between your spigot/velocity plugin or fabric/forge.
With this module you will be only dependent on LocalApi, which is an interface.
Currently Exposed is used for SQLite api-local, but you can replace it with anything you want. Only implementation will be changed, but LocalApi will be untouched, also as other functionality of your plugin/mod
This module contains remote api with RickMortyApi. It will return random character with suspend async response.
Like api-local
, this module also contains only jvm dependencies, so can be used in spigot/fabrict and others.
Sometimes you need to share constants generated at compile-time between other modules, so this module exactly what you need.
Usually this module contains shared translation/configuration or utilities.
I've not been working with this loaders too much, but th modules contains basic functionality with plugin information generation.
This plugin contains advanced and powerful spigot functionality
- GUI
- Commands
- Events
- Translation
- DI
- Permissions
- Configuration
- ORM(database)
- Reloading
(Click to expand) Lifecycle diagram
With this hierarchy its' possible to create independent modules
Each Module contains Lifecycle which is handled by it's parent module
Each Lifecycle contains three methods:
- onEnable
- onDisable
- onReload
In this example, we have RootPlugin
which is JavaPlugin
.
RootPlugin
contains list of child lifecycles.
Child lifecycles called when RootPlugins's lifecycle methods is called.
RootPlugin doesn't go beyond it's area of responsibility. All children handle it's own lifecycles.
classDiagram
class RootPlugin {
lifecycles
onEnable()
onDisable()
onReload()
}
RootPlugin ..> CoreModule: Child
RootPlugin ..> EventModule: Child
RootPlugin ..> DatabaseModule: Child
EventModule ..> MoveEventModule: Child
class MoveEventModule {
lifecycle: Lifecycle
onEnable()
onDisable()
}
class EventModule {
lifecycle: Lifecycle
onEnable()
onDisable()
}
class CoreModule {
lifecycle: Lifecycle
onReload()
}
class DatabaseModule {
lifecycle: Lifecycle
onEnable()
onDisable()
}
Command | Permission | Description |
---|---|---|
/add <player> <material> [amount] |
- |
Add item to player inventory |
/atemp translation |
- |
Show translation change after /atempreload |
/adamage <player> <amount> |
- |
Damage player |
/atempgui |
- |
Open sample gui |
/rickandmorty |
- |
Send to executor random RickMorty character |
Command | Permission | Description |
---|---|---|
/rickmorty |
- |
Rick morty character println |
/helloworld |
- |
Hello world println |
Command | Permission | Description |
---|---|---|
/helloworld |
- |
Hello world println |
- Spigot/Paper
- Fabric - Pre Alpha state
- Forge - Pre-Alpha state
- Velocity
Firstly, change gradle/libs.versions.toml destination-xxx to your folder
$ ./gradlew :plugin:shadowJar # assemble the plugin .jar
$ ./gradlew :velocity:shadowJar # assemble the plugin .jar
$ ./gradlew :fabric:build # assemble the fabric .jar
$ ./gradlew :forge:shadowJar # assemble the forge .jar
There's located docker-compose.yml which can launch any server you need for testing purposes.
Also, checkout AstraLearner - it will help you to learn foreign words easily!
AstraTemplate highly dependent on self-written open source libraries
- AstraLibs - Minecraft development
- klibs.mikro - Mapper, UseCase, Dispatchers interface
- klibs.kstorage - Key-value storage wrapper
- klibs.kdi - Manual DI