Example Plugin for educational purposes

I created a simple example plugin. It was made to explain how to create a command structure (with subcommands).

It is a simple server mail plugin with 4 commands:

  • /mail
  • /mail read
  • /mail clear
  • /mail send

Features:

  • Config file mail storage
  • Notifications about new mails

It uses Gradle for dependency management and comes with a Gradle wrapper.

There are a few TODO comments in the code, to mark the features which are missing for productive use.


You can find the source on GitHub: GitHub - boformer/SimpleMail: Simple Sponge Mail Plugin for educational use

6 Likes

Looks nice. The biggest problem with using this on a production server would be the fact that there’s no loading/saving of mail. A reload/restart would lose all saved mail.

That doesn’t seem like too big of an issue, because it just takes a few lines to save it do to file.

I wasn’t commenting on how easy the issue was to fix, merely why you wouldn’t use this as-is on a production server, as @boformer has already said.

This looks interesting :slight_smile: Perhaps some functionalities, such as recording the emails, could be added to help those who are learning to write plugins.

If you want, submit a pull request. I think some of the TODO markings can also be removed with little work.

I’d love to, but my suggestion is somewhat selfish iykwim :wink:

Very good! Good structured. Can we use your AbstractCommand?

1 Like

No need to ask.

Yes, you can use it. It is licensed under MIT.

1 Like

Sorry and thank you :grinning:

1 Like

I updated the plugin.

It now saves mails to a config file and notifies players about new mails.

Another Update: Use the new commands API and Sponge API 2.0

This is the part where the new commands API is used.

1 Like

Thanks much for this boformer. Really helped.

1 Like

Thank you for sharing this. This is a great resource for people like me, who are still learning.

2 Likes