Interface GUIContentsProvider
- All Known Implementing Classes:
PaginatingGUIContentsProvider,PlatformDifferentiatedGUIContentsProvider,TradeInventoryExample
public interface GUIContentsProvider
Determines what contents to show viewers on each page, the title of each page and if there is another page after this one.
Once the inventory for a given page has been opened the title won't be able to be changed without closing and re-opening the inventory,
this is due to a limitation in the Bukkit API and/or Minecraft.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe calculated result of a call togenContents(Player, int, GUISession, Callback)An instance of this object should be passed toCallback.call(Object)on the callback provided with genContents. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum allowed title length of Minecraft Java Edition -
Method Summary
Modifier and TypeMethodDescriptionvoidgenContents(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<GUIContentsProvider.GUIContentsResponse> callback) Calculate the GUIElements to display on this page and if another exists.voidgenTitle(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<String> callback) Calculate the title to display for a given page.
-
Field Details
-
MAX_JAVA_TITLE_LENGTH
static final int MAX_JAVA_TITLE_LENGTHThe maximum allowed title length of Minecraft Java Edition- See Also:
-
-
Method Details
-
genContents
void genContents(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<GUIContentsProvider.GUIContentsResponse> callback) Calculate the GUIElements to display on this page and if another exists. Once calculated the result (a GUIContentsResponse) should be passed to the provided callback. If the callback isn't called then the GUI will not work properly.- Parameters:
viewer- The viewer of this inventory. In the case of a GUI with multiple viewers (SharedInventoryGUI) this will be whatever viewer caused this method to be calledpage- The page to retrieve the contents for. Page 1 is the first page.session- The GUISession being viewedcallback- The callback to pass the response to. If the callback isn't called then the GUI will not work properly. Use theCallback.call(Object)method of the callback.
-
genTitle
void genTitle(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<String> callback) Calculate the title to display for a given page. Once calculated the result (a String) should be passed to the provided callback. If the callback isn't called then the GUI will not work properly.- Parameters:
viewer- The viewer of this inventory. In the case of a GUI with multiple viewers (SharedInventoryGUI) this will be whatever viewer caused this method to be calledpage- The page to retrieve the contents for. Page 1 is the first page.session- The GUISession being viewedcallback- The callback to pass the response to. If the callback isn't called then the GUI will not work properly. Use theCallback.call(Object)method of the callback.
-