Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Support addons loader #53

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Start Support addons loader #53

wants to merge 2 commits into from

Conversation

Euphillya
Copy link
Owner

@Euphillya Euphillya commented Jan 16, 2025

The logic behind this dynamic loading system is as follows:

  1. Extensions Folder: A specific folder (extensions) is created or used within the plugin's directory to store .jar files containing the extensions.

  2. Loading the .jar Files: Each .jar file is dynamically loaded using a URLClassLoader, allowing the classes inside the file to be accessible at runtime.

  3. Searching for Classes: The content of the .jar is scanned to identify classes implementing the SkylliaExtendsAddon interface.

  4. Instantiating Extensions: Classes implementing the interface are dynamically instantiated using Reflection, enabling the creation of objects even if their code is unknown to the main plugin.

  5. Lifecycle of Extensions:

  • onLoad(): Called after instantiation to initialize the extension with a reference to the main plugin.

  • onEnable(): Called after the main plugin starts, allowing the extensions to register commands, listeners, etc.

  • onDisable(): Called when the main plugin shuts down to let extensions clean up their resources.

In summary, the main plugin acts as an extension manager, dynamically detecting and enabling additional functionality without integrating it directly into its core code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant