Skip to content

zielinsky/scala-minecaft-example-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala 3 Minecraft Plugin for PaperMC

A boilerplate Minecraft plugin written in Scala 3 LTS for PaperMC servers using SBT as the build tool.

Prerequisites

  • Java 17 or higher
  • SBT (Scala Build Tool)
  • Scala 3.3.4 LTS
  • PaperMC server (1.20.2 or compatible version)

Project Structure

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

Building the Plugin

  1. Clean and compile:

    sbt clean compile
  2. Create plugin JAR:

    sbt assembly

    This will create a JAR file in target/scala-3.3.4/scala-plugin-1.0.0.jar

  3. Copy to server:

    cp target/scala-3.3.4/scala-plugin-1.0.0.jar /path/to/your/server/plugins/

Development

Running in Development

For development, you can use:

sbt
~compile  # Auto-recompile on file changes

Testing

Add your tests in src/test/scala/ and run:

sbt test

Features

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

Configuration

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

Commands

  • /hello [message] - Says hello to the player (permission: scalaplugin.hello)

Permissions

  • scalaplugin.hello - Allows use of the hello command (default: true)
  • scalaplugin.admin - Administrative permissions (default: op)

Troubleshooting

Common Issues

  1. Java Version Mismatch: Ensure you're using Java 17+ for both compilation and runtime
  2. Dependency Issues: Run sbt clean if you encounter strange compilation errors
  3. Plugin Not Loading: Check server logs for specific error messages

Building for Different MC Versions

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"

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is provided as-is for educational and development purposes.

About

A boilerplate Minecraft plugin written in Scala 3 LTS for PaperMC servers using SBT as the build tool.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published