Creating Extensions (Modules) - TheSourceCodeLLC/Source GitHub Wiki
Creating Extensions (Modules)
First and foremost, Extensions that have been deemed official are housed in the net.sourcebot.module
package.
If you are not interested in creating an official module, please do not use this package when creating your module.
If you are not creating an official module, you should not be working in the Source git tree, so that you do not commit your module to the repository.
Pull requests that introduce unofficial modules will not be merged.
Writing Official Extensions
- Fork the repository and clone it locally
- Introduce a new Gradle submodule in the
Extensions
parent module - Create a
module.json
in your submodule'smain/resources
folder using the following template: Make sure you leave${}
variables alone; they are processed by Gradle!
{
"main": "net.sourcebot.module.(module name).(main class name)",
"name": "${project.name}",
"version": "${project.version}",
"description": "${project.description}",
"author": "(your name or discord tag)"
}
- Create a class at the path
net.sourcebot.module.(module name).(main class name)
- Make this new class
extend SourceModule
i.e:
package net.sourcebot.module.mymodule
class MyModule : SourceModule()
- From here on, you may override methods in the
MyModule
class (example) such asonEnable()
oronDisable()
- Commit your changes to your repository, and open a Pull Request when you are ready.
Writing Unofficial Extensions
- Depend on
net.sourcebot:API
- Create a class that
extends SourceModule
, this will be your main class:
class MyModule : SourceModule()
- Create a
module.json
in yourmain/resources
folder using the following template:
{
"main": "(path to main class)",
"name": "(module name)",
"version": "(module version)",
"description": "(module description",
"author": "(your name or discord tag)"
}
- Override methods in the
MyModule
class (example) such asonEnable()
oronDisable()