-
-
Notifications
You must be signed in to change notification settings - Fork 21
How addons work
API classes related to lifecycle:
To access, you need to use VisorAPI#clientState() method
Addons system is an essential part of Visor architecture.
It allows to modify or extend parts of the Visor without using mixins.
It is built to support many addons at once with compatibility between each other.
Addons can be registered via VisorAPI#addonManager() only before VisorClient initialized. All registered addons are loaded during initialization of VisorClient.
Addons cannot be unloaded from Visor for better compatibility, predictability.
Visor Elements are what you actually use to extend or modify Visor functionality.
Each element can be enabled/disabled and some of them supports priority, that affects on the order at which added elements used.
Each element has its owner, i.e. Addon. And each element has its ID
To add your element to Visor you need to:
- get instance of registry you need and add your element there
- If element supports auto-registering, you can use annotation related specifically to that element
For auto-registering to see your elements, you have to correctly specify the addon package path in VisorAddon.class. The path have to not collide with path of any other addon to not cause elements to be duplicated(that will owerride old ones and makes attached to your addon)
What are the element registries?
That is where elements are managed. You can use them to add/remove any element via its ID or remove all elements with specified owner.
Currently available Visor elements and their registries:
... ...