Class PlayerOpenShopEvent
- All Implemented Interfaces:
ArenaEvent
,Cancellable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorDescriptionPlayerOpenShopEvent
(Player player, @Nullable Arena arena, ShopLayout layout, ShopOpenCause cause, @Nullable ShopPage page, @Nullable Object layoutData) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addShopItem
(ShopItem shopItem) Tries to add a shopItem.@Nullable Arena
getArena()
Returns the arena (of the player) in which the shop was opened.getCause()
Returns the way how the player opened the shop@Nullable ShopPage
Returns the cloned page that was opened.static HandlerList
getItems()
Gets all the items that the player would theoretically see in the GUI.Returns the layout that will be used for the GUI.@Nullable Object
A layout may hold and pass around data during its session.boolean
boolean
removeShopItem
(ShopItem shopItem) Tries to remove a shop item and causes it to not be seen.void
setCancelled
(boolean bool) void
setLayout
(ShopLayout layout) Set the layout of the shop GUI that shall be shown.void
setLayoutData
(@Nullable Object layoutData) A layout may hold and pass around data during its session.void
Sets the page that shall be opened.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerOpenShopEvent
public PlayerOpenShopEvent(Player player, @Nullable @Nullable Arena arena, ShopLayout layout, ShopOpenCause cause, @Nullable @Nullable ShopPage page, @Nullable @Nullable Object layoutData)
-
-
Method Details
-
getArena
Returns the arena (of the player) in which the shop was opened.May be
null
if the player isn't actually a part of a match as he e.g. used/bw tools
to open and debug it.- Specified by:
getArena
in interfaceArenaEvent
- Returns:
- The arena in which the shop was opened
-
getLayout
Returns the layout that will be used for the GUI.- Returns:
- The layout that shall be shown
-
setLayout
Set the layout of the shop GUI that shall be shown.- Parameters:
layout
- The layout that shall be shown to the player
-
getClonedPage
Returns the cloned page that was opened.Is may returns
null
when the shop was opened the first time. In this case, it will likely open the main page (what exactly happens depends on the layout).Note that this the page will always be cloned, that is because to give the layout more freedom in designing the GUIs without affecting the original states. You may use
ShopPage.getOriginal()
to get the non-cloned page.- Returns:
- The page that shall be shown
-
setPage
Sets the page that shall be opened.Is may be
null
when the shop was opened the first time. In this case, it will likely open the main page (what exactly happens depends on the layout).This method also automatically clones the page if it hasn't been already.
- Parameters:
page
- The new page
-
getItems
Gets all the items that the player would theoretically see in the GUI.May be
null
ifgetClonedPage()
returns null as well.- Returns:
- The items that the player would see in the GUI
-
removeShopItem
Tries to remove a shop item and causes it to not be seen.- Parameters:
shopItem
- The shopItem that shall be removed- Returns:
true
if it has been removed- Throws:
IllegalStateException
- If the shopItem is not cloned
-
addShopItem
Tries to add a shopItem.- Parameters:
shopItem
- The cloned shopItem that shall be added- Returns:
true
if it has been successfully added- Throws:
IllegalStateException
- If the shopItem is not cloned
-
getLayoutData
A layout may hold and pass around data during its session.This might be useful when you're trying to manipulate the layout.
- Returns:
- The layout specific data
-
setLayoutData
A layout may hold and pass around data during its session.This might be useful when you're trying to manipulate the layout. Keep in mind that errors might occur with the layout when inserting unexpected data.
- Parameters:
layoutData
- The new layout data
-
getCause
Returns the way how the player opened the shop- Returns:
- The cause of the opening
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceCancellable
-
setCancelled
public void setCancelled(boolean bool) - Specified by:
setCancelled
in interfaceCancellable
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-