Package dev.aurelium.slate
Class Slate
java.lang.Object
dev.aurelium.slate.Slate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLoadedMenu(LoadedMenu menu) voidaddMergeDirectory(File mergeDir) voidbuildMenu(String name, Consumer<MenuBuilder> menu) Creates a new menu with a name and a consumer to build the menu.voidGenerates missing menu files into theSlateOptions.mainDirectory()based on the menu names registered previously throughbuildMenu(String, Consumer).@NotNull BuiltMenugetBuiltMenu(String name) Gets a built menu by its name.@Nullable LoadedMenugetLoadedMenu(String name) intorg.bukkit.plugin.java.JavaPluginbooleanintLoads all menu files in the mainDirectory defined inSlateOptionsand uses any mergeDirectories defined to merge menu files together before loading.voidOpens a menu for a player.voidOpens a menu for a player with a defined page.voidOpens a menu for a player with defined properties.voidOpens a menu for a player with defined properties and page.voidopenMenuUnchecked(org.bukkit.entity.Player player, String name, Map<String, Object> properties, int page) Opens a menu for a player with defined properties and page without checking for exceptions during opening.voidremoveMergeDirectory(File mergeDir) voidsetGlobalBehavior(Consumer<GlobalBehaviorBuilder> options) void
-
Constructor Details
-
Slate
-
-
Method Details
-
loadMenus
public int loadMenus()Loads all menu files in the mainDirectory defined inSlateOptionsand uses any mergeDirectories defined to merge menu files together before loading. Files are registered as aLoadedMenuafter loading.- Returns:
- the number of menus successfully loaded
-
generateFiles
public void generateFiles()Generates missing menu files into theSlateOptions.mainDirectory()based on the menu names registered previously throughbuildMenu(String, Consumer). -
openMenu
public void openMenu(org.bukkit.entity.Player player, String name, Map<String, Object> properties, int page) Opens a menu for a player with defined properties and page.- Parameters:
player- the player to open the menu forname- the name of the menu to openproperties- the properties to use in the menupage- the page to open the menu on, starts at 0
-
openMenuUnchecked
public void openMenuUnchecked(org.bukkit.entity.Player player, String name, Map<String, Object> properties, int page) Opens a menu for a player with defined properties and page without checking for exceptions during opening. This means that if the menu throws an exception during opening, it will not be automatically closed for the player. Useful for custom error logging.- Parameters:
player- the player to open the menu forname- the name of the menu to openproperties- the properties to use in the menupage- the page to open the menu on, starts at 0
-
openMenu
Opens a menu for a player with defined properties.- Parameters:
player- the player to open the menu forname- the name of the menu to openproperties- the properties to use in the menu
-
openMenu
Opens a menu for a player with a defined page.- Parameters:
player- the player to open the menu forname- the name of the menu to openpage- the page to open the menu on, starts at 0
-
openMenu
Opens a menu for a player.- Parameters:
player- the player to open the menu forname- the name of the menu to open
-
unregisterMenus
public void unregisterMenus() -
getPlugin
public org.bukkit.plugin.java.JavaPlugin getPlugin() -
getContextManager
-
getInventoryManager
-
getActionManager
-
isPlaceholderAPIEnabled
public boolean isPlaceholderAPIEnabled() -
getLoreWrappingWidth
public int getLoreWrappingWidth() -
getOptions
-
getScheduler
-
getItemProtection
-
buildMenu
Creates a new menu with a name and a consumer to build the menu. This registers the menu in the backend to be used to define behavior for the frontend menu file of the same name.- Parameters:
name- the name of the menu, must match the name of the menu file without the extensionmenu- the consumer to build the menu, best used as a lambda
-
getBuiltMenu
Gets a built menu by its name.- Parameters:
name- the name of the menu- Returns:
- the built menu, or an empty menu if the menu does not exist
-
getBuiltMenus
-
getLoadedMenu
-
getLoadedMenus
-
setGlobalBehavior
-
getGlobalBehavior
-
addMergeDirectory
-
removeMergeDirectory
-