Interface ShopLayoutHandler.OpenEvent
- Enclosing interface:
ShopLayoutHandler
public static interface ShopLayoutHandler.OpenEvent
Used to pass information to
ShopLayoutHandler.build(OpenEvent)
-
Method Summary
Modifier and TypeMethodDescriptionBuilds a GUIItem that can be used to set the item inside the GUIdefault GUIItem
Builds a GUIItem that can be used to set the page inside the GUI.
Also resets the current data back to null once pressedBuilds a GUIItem that can be used to set the page inside the GUIBuilds a GUIItem that will flush any info about the info on click.
This behavior is similar to as if the player is closing and reopening the shopbuildOffer
(ShopItem item) Builds a GUIItem that can be used to set the page inside the villager GUI@Nullable Arena
getArena()
Returns the arena the player is a part of.getData()
The default value is null<T> T
getData
(T def) Returns data that can be used during the sessionDeprecated.Returns the layout that has been opened@Nullable ShopPage
The currently open page
Can be null when there's no page openAll items that should be displayed to the playergetPages()
The available pages with which the handler has to work with
The collections and EVERYTHING in the collection has been cloned,
meaning the handler can do anything with it that he wantsReturns the player that opened itReturns the already loaded and ready to use player properties instance of the playerReturns what shall be shown in this given sitation.boolean
Returns whether the title of the GUI should be the same as the shop page.void
refresh()
Will reopen the current GUIvoid
setOpenPage
(@Nullable ShopPage page) Sets the new open page.
Won't reopen the GUI when set
-
Method Details
-
getLayout
ShopLayout getLayout()Returns the layout that has been opened- Returns:
- The layout
-
getPlayer
Player getPlayer()Returns the player that opened it- Returns:
- The player
-
getArena
Returns the arena the player is a part of.- Returns:
- The arena of the player. May be
null
of he's in none
-
getPlayerProperties
PlayerProperties getPlayerProperties()Returns the already loaded and ready to use player properties instance of the player- Returns:
- The PlayerProperties instance of the given player
-
getDefaultGUITitle
Deprecated.UsegetSituationalGUITitle()
instead to respect the user's configurationsReturns the default title that shall be used in the GUI- Returns:
- The title that shall be used in the GUI
-
getSituationalGUITitle
String getSituationalGUITitle()Returns what shall be shown in this given sitation.The exact value depends on the plugin configuration.
Factors include e.g.: WhetherisGUITitleAsShopPage()
should be conisdered and what messages have been configured.The plugin does not automatically apply it. Make sure to apply it after setting the shop page.
- Returns:
- The title that shall be used in the GUI
-
isGUITitleAsShopPage
boolean isGUITitleAsShopPage()Returns whether the title of the GUI should be the same as the shop page.Whether this feature is active depends on the plugin configuration.
The plugin will handle this automatically. One edge case is when you have custom pages (e.g. quick buy): In this case you should check if this feature is enabled and set it yourself.- Returns:
- Whether the title of the GUI should be the same as the shop page
-
getPages
The available pages with which the handler has to work with
The collections and EVERYTHING in the collection has been cloned,
meaning the handler can do anything with it that he wants- Returns:
- The available pages
-
getOpenPage
The currently open page
Can be null when there's no page open- Returns:
- The currently open page
-
setOpenPage
Sets the new open page.
Won't reopen the GUI when set- Parameters:
page
- The new open page, can be null
-
getPageItems
All items that should be displayed to the player- Returns:
- all items that will be displayed
-
getData
Object getData()The default value is null- Returns:
- Data that can be passed around
-
getData
<T> T getData(T def) Returns data that can be used during the session- Type Parameters:
T
- (Unsafe operation:) Automatically casts the intern data object to the given generic- Parameters:
def
- The default value which will be taken if none is set- Returns:
- Data that can be passed around
-
refresh
void refresh()Will reopen the current GUI -
build
Builds a GUIItem that can be used to set the item inside the GUI- Parameters:
item
- The item that shall be displayed- Returns:
- The item that shall be placed inside the GUI
-
build
Builds a GUIItem that can be used to set the page inside the GUI.
Also resets the current data back to null once pressed- Parameters:
page
- The page that shall be displayed- Returns:
- The item that shall be placed inside the GUI
-
build
Builds a GUIItem that can be used to set the page inside the GUI- Parameters:
page
- The page that shall be displayeddata
- The new data that will be taken after pressing on the page- Returns:
- The item that shall be placed inside the GUI
-
buildOffer
Builds a GUIItem that can be used to set the page inside the villager GUI- Parameters:
item
- The item that shall be displayed- Returns:
- The item that shall be placed inside the GUI
-
buildHome
Builds a GUIItem that will flush any info about the info on click.
This behavior is similar to as if the player is closing and reopening the shop- Parameters:
is
- The item that shall be presented as the button- Returns:
- The item that shall be placed inside the GUI
-
getSituationalGUITitle()
instead to respect the user's configurations