Class GUI

  • Direct Known Subclasses:
    PersonalGUI, SharedGUI

    public abstract class GUI
    extends java.lang.Object
    This class is the representation of a GUI
    • Constructor Summary

      Constructors 
      Constructor Description
      GUI​(@NotNull java.lang.String name, @NotNull org.bukkit.plugin.Plugin plugin)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull Page createPage​(@NotNull java.lang.String name, @NotNull Size size)
      Create a page and add it to page list
      boolean equals​(java.lang.Object obj)
      Determine if an object is equals to this object
      @NotNull java.lang.String getName()
      Get the name of the GUI
      @Nullable Page getPage​(@NotNull java.lang.String name)
      Get the selected page using name
      java.util.Set<Page> getPages()
      Get the pages of the GUI
      protected @NotNull Page nextPage​(@NotNull Page currentPage, @NotNull org.bukkit.entity.Player player)
      Show the next page according to the current page
      protected @NotNull Page openGUI​(@NotNull org.bukkit.entity.Player player)
      Open the GUI to the selected player (first page)
      protected @NotNull Page showPage​(@NotNull Page page, @NotNull org.bukkit.entity.Player player)
      Show the selected page to the selected player
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GUI

        public GUI​(@NotNull
                   @NotNull java.lang.String name,
                   @NotNull
                   @NotNull org.bukkit.plugin.Plugin plugin)
        Default constructor
        Parameters:
        name - Name of the GUI
        plugin - Your plugin instance
    • Method Detail

      • getPage

        @Nullable
        public @Nullable Page getPage​(@NotNull
                                      @NotNull java.lang.String name)
        Get the selected page using name
        Parameters:
        name - Name of the page
        Returns:
        The page found or null
      • createPage

        @NotNull
        public @NotNull Page createPage​(@NotNull
                                        @NotNull java.lang.String name,
                                        @NotNull
                                        @NotNull Size size)
        Create a page and add it to page list
        Parameters:
        name - Name of the page
        size - Size of the page
        Returns:
        The page created
      • openGUI

        @NotNull
        protected @NotNull Page openGUI​(@NotNull
                                        @NotNull org.bukkit.entity.Player player)
        Open the GUI to the selected player (first page)
        Parameters:
        player - Player wanted
        Returns:
        The page opened
      • showPage

        @NotNull
        protected @NotNull Page showPage​(@NotNull
                                         @NotNull Page page,
                                         @NotNull
                                         @NotNull org.bukkit.entity.Player player)
        Show the selected page to the selected player
        Parameters:
        page - Page to show
        player - Player wanted
        Returns:
        The page show
      • nextPage

        @NotNull
        protected @NotNull Page nextPage​(@NotNull
                                         @NotNull Page currentPage,
                                         @NotNull
                                         @NotNull org.bukkit.entity.Player player)
        Show the next page according to the current page
        Parameters:
        currentPage - The current page
        player - The player wanted
        Returns:
        The page next page or the current if there is no next page
      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Get the name of the GUI
        Returns:
        Name of the GUI
      • getPages

        public java.util.Set<Page> getPages()
        Get the pages of the GUI
        Returns:
        Pages of the GUI
      • equals

        public boolean equals​(java.lang.Object obj)
        Determine if an object is equals to this object
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to check
        Returns:
        true if equals false if not