Oheers / EvenMoreFish

An advanced fishing plugin based on MoreFish, created 2 years after its last update.
MIT License
91 stars 55 forks source link

Adds addon system #221

Closed sarhatabaot closed 11 months ago

sarhatabaot commented 11 months ago

This PR does a couple of things, that in reality, probably should have been split up into 2 PRs.

  1. Split the project into multi modules: plugin, api, addons
  2. Implement an addon system to allow for backwards compatibility with Java 8.

Addon System:

Allows developers to create simple clean code for item obtaining in EMF. For example: "itemsadder:id" or "oraxen:id". This was done since some plugins require different Java version to run, so the plugin would fail to compile if we are running against Java 8.

Addons target Java 8 by default, this should be overwritten if needed. For example: oraxen requires java 17.

A note about compiling: We must package the addon files internally as ".addon", we then rename them later - this is done when the plugin loads. For other developers this is not needed and can be ignored.

Loading

On the first load the addon will check if the required plugins are present, this reduces some repeated code in EvenMoreFish.java Addons will also check if their required java version is present, if you're trying to load the oraxen addon in Java 8 it will fail gracefully and log an error.

Config Changes:

Added use-additional-addons config option. Set to true by default. This extracts the default addons from the jar into the addons folder.

Default Addons

Template: even-more-fish-addons-j<version>, for example even-more-fish-addons-j17 in a module.

For addons that target Java 8, we should use the even-more-fish-plugin module, with the com.oheers.evenmorefish.addons.impl package.

Commands

Admin command to view currently installed addons. And if they are loading or not. /emf admin addons

Addons added:

sarhatabaot commented 11 months ago

This will definitely require some editing to be done to the ci/cd system at codemc.