Package fr.maxlego08.menu.api
Interface ButtonManager
public interface ButtonManager
The `ButtonManager` interface provides a centralized management system for buttons, allowing the creation,
registration, and retrieval of various types of buttons through designated loaders.
Documentation: ButtonManager Documentation
To create a Button, use a ButtonLoader, and then register it with the `ButtonManager`.
Buttons can be managed by plugins using this interface, facilitating dynamic menu creation and interaction.
-
Method Summary
Modifier and TypeMethodDescriptiongetActionLoader(String key) Retrieves an optionalActionLoaderbased on an action key.Retrieves aButtonLoaderbased on the class of the associatedButton.Retrieves aButtonLoaderbased on the name of the associatedButton.Retrieves a collection of all registeredButtonLoaders.getLoaders(org.bukkit.plugin.Plugin plugin) Retrieves a collection ofButtonLoaders associated with a specific plugin.Retrieves a map of permissible keys and associatedPermissibleLoaders.getPermission(String key) Retrieves an optionalPermissibleLoaderbased on a permissible key.List<fr.maxlego08.menu.api.requirement.Action>Transforms a list of map elements from a configuration file into a list of actions.List<fr.maxlego08.menu.api.requirement.Permissible>Transforms a list of map elements from a configuration file into a list of permissibles.voidregister(ButtonLoader button) Registers a newButtonLoaderfor handling button creation.voidregisterAction(ActionLoader actionLoader) Registers a newActionLoaderfor handling action creation.voidregisterPermissible(PermissibleLoader permissibleLoader) Registers a newPermissibleLoaderfor handling permissible creation.voidunregister(ButtonLoader button) Unregisters aButtonLoaderto stop handling button creation.voidunregisters(org.bukkit.plugin.Plugin plugin) Unregisters allButtonLoaders associated with a specific plugin.
-
Method Details
-
unregisters
void unregisters(org.bukkit.plugin.Plugin plugin) Unregisters allButtonLoaders associated with a specific plugin.- Parameters:
plugin- The plugin for which to unregister all loaders.
-
getLoaders
Collection<ButtonLoader> getLoaders()Retrieves a collection of all registeredButtonLoaders.- Returns:
- A collection of
ButtonLoaders.
-
getLoaders
Retrieves a collection ofButtonLoaders associated with a specific plugin.- Parameters:
plugin- The plugin for which to retrieve loaders.- Returns:
- A collection of
ButtonLoaders or an empty collection if none are found.
-
getLoader
Retrieves aButtonLoaderbased on the class of the associatedButton.- Parameters:
classz- Class ofButton.- Returns:
- An optional
ButtonLoader.
-
getLoader
Retrieves aButtonLoaderbased on the name of the associatedButton.- Parameters:
name- The name of theButtonLoader.- Returns:
- An optional
ButtonLoader.
-
getPermissibles
Map<String,PermissibleLoader> getPermissibles()Retrieves a map of permissible keys and associatedPermissibleLoaders.- Returns:
- A map of permissible keys to
PermissibleLoaders.
-
getPermission
Retrieves an optionalPermissibleLoaderbased on a permissible key.- Parameters:
key- The key associated with the permissible.- Returns:
- An optional
PermissibleLoader.
-
getActionLoader
Retrieves an optionalActionLoaderbased on an action key.- Parameters:
key- The key associated with the action.- Returns:
- An optional
ActionLoader.
-
loadPermissible
List<fr.maxlego08.menu.api.requirement.Permissible> loadPermissible(List<Map<String, Object>> elements, String path, File file) Transforms a list of map elements from a configuration file into a list of permissibles.- Parameters:
elements- List of items from the configuration containing the entire configuration of a permissible.path- The path to or from the list of permissibles.file- The current configuration file.- Returns:
- A list of
Permissibles.
-
loadActions
List<fr.maxlego08.menu.api.requirement.Action> loadActions(List<Map<String, Object>> elements, String path, File file) Transforms a list of map elements from a configuration file into a list of actions. Documentation about actions: Action Documentation- Parameters:
elements- List of items from the configuration containing the entire configuration of an action.path- The path to or from the list of actions.file- The current configuration file.- Returns:
- A list of
Actions.