This is a Minecraft Multiplatform template that provides architecture and various tools you'll need to create new Spigot/Velocity 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 2 years of developing spigot plugins and android applications. It contains powerful and scalable architecture template which will help you in your development.
├── modules
│ ├── api-local # Local api with SQLite
│ ├── api-remote # Remote sample RickMorty API
│ └── core # Core multiplatform module
├── forge # Forge template mod
├── fabric # Fabric template mod
├── velocity # Velocity template plugin
└── plugin # Bukkit template mod
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 contains no spigot/velocity/fabric dependencies. 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 AstraLibs-orm 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 models between other modules, so this module contains shared data models.
Usually all instances(forge/bukkit) have the same logic, which can be located here without depending on platform
I've not been working with velocity too much, but this modules contains basic functionality with plugin information generation.
This plugin contains advanced and powerful spigot functionality
- GUI
- Commands
- Events
- Translation
- DI
- Permissions
- Configuration
(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
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