A boilerplate Minecraft plugin written in Scala 3 LTS for PaperMC servers using SBT as the build tool.
- Java 17 or higher
- SBT (Scala Build Tool)
- Scala 3.3.4 LTS
- PaperMC server (1.20.2 or compatible version)
scala-plugin/
├── build.sbt # SBT build configuration
├── project/
│ ├── build.properties # SBT version
│ └── plugins.sbt # SBT plugins
├── src/
│ └── main/
│ ├── scala/
│ │ └── com/example/scalaplugin/
│ │ ├── ScalaPlugin.scala # Main plugin class
│ │ └── HelloCommand.scala # Example command
│ └── resources/
│ ├── plugin.yml # Plugin configuration
│ └── config.yml # Default plugin config
└── README.md
-
Clean and compile:
sbt clean compile
-
Create plugin JAR:
sbt assembly
This will create a JAR file in
target/scala-3.3.4/scala-plugin-1.0.0.jar
-
Copy to server:
cp target/scala-3.3.4/scala-plugin-1.0.0.jar /path/to/your/server/plugins/
For development, you can use:
sbt
~compile # Auto-recompile on file changes
Add your tests in src/test/scala/
and run:
sbt test
This boilerplate includes:
- Event Listeners: Player join/quit events
- Commands:
/hello
command with permissions - Configuration: YAML configuration file support
- Logging: Proper server logging integration
- Permissions: Bukkit permission system integration
- Scala 3: Built with the latest Scala 3 LTS for modern language features
Edit src/main/resources/config.yml
to customize plugin behavior:
messages:
welcome: "Welcome to the server, powered by Scala 3!"
goodbye: "Thanks for playing!"
features:
welcome-message: true
logging: true
/hello [message]
- Says hello to the player (permission:scalaplugin.hello
)
scalaplugin.hello
- Allows use of the hello command (default: true)scalaplugin.admin
- Administrative permissions (default: op)
- Java Version Mismatch: Ensure you're using Java 17+ for both compilation and runtime
- Dependency Issues: Run
sbt clean
if you encounter strange compilation errors - Plugin Not Loading: Check server logs for specific error messages
To target a different Minecraft version, update the Paper API version in build.sbt
:
"io.papermc.paper" % "paper-api" % "1.20.1-R0.1-SNAPSHOT" % "provided"
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is provided as-is for educational and development purposes.