Package dev.aurelium.auraskills.api.menu
Interface MenuManager
public interface MenuManager
An interface used to interact with menus, including building, opening, and extending menus.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Provides access to aMenuBuilder
for building a Slate menu.void
openLevelProgressionMenu
(org.bukkit.entity.Player player, Skill skill) Opens the AuraSkills level progression menu for a player.void
Opens a menu for a player with the given name.void
Opens a menu for a player with the given name and properties.void
Opens a menu for a player with the given name, properties, and page.<T> void
registerContext
(String key, Class<T> contextClass, ContextParser<T> parser) Registers a context parser to a context class necessary for creating a template with a custom type parameter.void
registerGlobalReplacer
(dev.aurelium.slate.function.ItemReplacer replacer) Registers a placeholder replacer that applies to placeholders in all menus.
-
Method Details
-
buildMenu
Provides access to aMenuBuilder
for building a Slate menu. If the name is not an AuraSkills default menu, a new MenuBuilder is created and registered to Slate. Otherwise, the menu builder for an existing menu will be provided to extend an existing menu.- Parameters:
name
- the name of the menumenu
- a consumer for the menu builder
-
openMenu
Opens a menu for a player with the given name.- Parameters:
player
- the player to open the menu forname
- the name of the menu as registered in Slate
-
openMenu
Opens a menu for a player with the given name and properties.- Parameters:
player
- the player to open the menu forname
- the name of the menu as registered in Slateproperties
- the properties to pass to the menu
-
openMenu
void openMenu(org.bukkit.entity.Player player, String name, Map<String, Object> properties, int page) Opens a menu for a player with the given name, properties, and page.- Parameters:
player
- the player to open the menu forname
- the name of the menu as registered in Slateproperties
- the properties to pass to the menupage
- the page to open the menu to
-
openLevelProgressionMenu
Opens the AuraSkills level progression menu for a player. Required properties and the correct page to open to are automatically handled by this method versus the generic openMenu methods.- Parameters:
player
- the player to open the menu forskill
- the skill to open to
-
registerGlobalReplacer
void registerGlobalReplacer(dev.aurelium.slate.function.ItemReplacer replacer) Registers a placeholder replacer that applies to placeholders in all menus. If a placeholder shouldn't be replaced, theItemReplacer
should return null to not replace, so other global replacers can check that placeholder.- Parameters:
replacer
- the placeholder replacer that takes aPlaceholderInfo
argument and returns the replaced String.
-