Class Slate

java.lang.Object
dev.aurelium.slate.Slate

public class Slate extends Object
  • Constructor Details

    • Slate

      public Slate(org.bukkit.plugin.java.JavaPlugin plugin, SlateOptions options)
  • Method Details

    • loadMenus

      public int loadMenus()
      Loads all menu files in the mainDirectory defined in SlateOptions and uses any mergeDirectories defined to merge menu files together before loading. Files are registered as a LoadedMenu after loading.
      Returns:
      the number of menus successfully loaded
    • generateFiles

      public void generateFiles()
      Generates missing menu files into the SlateOptions.mainDirectory() based on the menu names registered previously through buildMenu(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 for
      name - the name of the menu to open
      properties - the properties to use in the menu
      page - 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 for
      name - the name of the menu to open
      properties - the properties to use in the menu
      page - the page to open the menu on, starts at 0
    • openMenu

      public void openMenu(org.bukkit.entity.Player player, String name, Map<String,Object> properties)
      Opens a menu for a player with defined properties.
      Parameters:
      player - the player to open the menu for
      name - the name of the menu to open
      properties - the properties to use in the menu
    • openMenu

      public void openMenu(org.bukkit.entity.Player player, String name, int page)
      Opens a menu for a player with a defined page.
      Parameters:
      player - the player to open the menu for
      name - the name of the menu to open
      page - the page to open the menu on, starts at 0
    • openMenu

      public void openMenu(org.bukkit.entity.Player player, String name)
      Opens a menu for a player.
      Parameters:
      player - the player to open the menu for
      name - the name of the menu to open
    • unregisterMenus

      public void unregisterMenus()
    • getPlugin

      public org.bukkit.plugin.java.JavaPlugin getPlugin()
    • getContextManager

      public ContextManager getContextManager()
    • getInventoryManager

      public InventoryManager getInventoryManager()
    • getActionManager

      public ActionManager getActionManager()
    • isPlaceholderAPIEnabled

      public boolean isPlaceholderAPIEnabled()
    • getLoreWrappingWidth

      public int getLoreWrappingWidth()
    • getOptions

      public SlateOptions getOptions()
    • getScheduler

      public Scheduler getScheduler()
    • getItemProtection

      public ItemProtection getItemProtection()
    • buildMenu

      public void buildMenu(String name, Consumer<MenuBuilder> menu)
      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 extension
      menu - the consumer to build the menu, best used as a lambda
    • getBuiltMenu

      @NotNull public @NotNull BuiltMenu getBuiltMenu(String name)
      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

      public Map<String,BuiltMenu> getBuiltMenus()
    • addLoadedMenu

      public void addLoadedMenu(LoadedMenu menu)
    • getLoadedMenu

      @Nullable public @Nullable LoadedMenu getLoadedMenu(String name)
    • getLoadedMenus

      public Map<String,LoadedMenu> getLoadedMenus()
    • setGlobalBehavior

      public void setGlobalBehavior(Consumer<GlobalBehaviorBuilder> options)
    • getGlobalBehavior

      public GlobalBehavior getGlobalBehavior()
    • addMergeDirectory

      public void addMergeDirectory(File mergeDir)
    • removeMergeDirectory

      public void removeMergeDirectory(File mergeDir)