Class PlayerBuyInShopEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerBuyInShopEvent
- All Implemented Interfaces:
- ArenaEvent
Gets called when a player is buying an item from the shop
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumDefault problems used and provided by the pluginstatic classNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerBuyInShopEvent(Player player, Arena arena, ShopItem item, @Nullable ShopItem clonedItem, ShopOpenCause openCause, boolean shiftClick, @Nullable Integer targetInvSlot, int multiplier, List<PlayerBuyInShopEvent.Problem> problems, boolean giveProducts, boolean takePayments) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAdd a problem that will prevent the item from being bought.booleanaddProblem(PlayerBuyInShopEvent.Problem problem) Add a problem that will prevent the item from being bought.@Nullable ArenagetArena()Returns the arena in which the player is playing.@Nullable ShopItemGet the cloned item that was used withinPlayerOpenShopEvent.getClonedPage().static HandlerListgetItem()Returns the item that the player wants to buy.intReturns how much it has been multiplied by shift-clicking.Returns they way the player opened the shop.Returns the problems that are preventing the item from being bought@Nullable IntegerPlayer clicked on a specific number on his keyboard while buying.booleanReturns whether or not the player will receive the products of the item.booleanReturns whether or not the player shift-clicked while buying the item and by that tries to buy a whole stack.booleanReturns whether or not the it'll take the payments from the player.intRemoves all problems and makes it buyable by that.booleanRemoves a problem.booleanRemoves a problem.voidsetGivingProducts(boolean giveProducts) Define whether or not if he'll get products.voidsetMultiplier(int multiplier) Set how often/many items he should receive the item.voidsetTakingPayments(boolean takePayments) Define whether or not the payments will be taken from the player.Methods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
PlayerBuyInShopEventpublic PlayerBuyInShopEvent(Player player, Arena arena, ShopItem item, @Nullable @Nullable ShopItem clonedItem, ShopOpenCause openCause, boolean shiftClick, @Nullable @Nullable Integer targetInvSlot, int multiplier, List<PlayerBuyInShopEvent.Problem> problems, boolean giveProducts, boolean takePayments) 
 
- 
- 
Method Details- 
getArenaReturns the arena in which the player is playing.- Specified by:
- getArenain interface- ArenaEvent
- Returns:
- The player's arena. Can be nullif the player is using the shop outside of an arena.
 
- 
getItemReturns the item that the player wants to buy.- Returns:
- The item that he's trying to buy
 
- 
getClonedItemGet the cloned item that was used withinPlayerOpenShopEvent.getClonedPage().- Returns:
- If known, the cloned item that was used to render the shop. Otherwise null.
 
- 
getOpenCauseReturns they way the player opened the shop.- Returns:
- The open cause
 
- 
isShiftClickpublic boolean isShiftClick()Returns whether or not the player shift-clicked while buying the item and by that tries to buy a whole stack.- Returns:
- If he shift-clicked
 
- 
getTargetInvSlotPlayer clicked on a specific number on his keyboard while buying.The given number represents the hotbar slot he wants to put the item in. - Returns:
- The target inv slot to which the bought item shall be added to. May be nullif that doesn't matter
 
- 
getMultiplierpublic int getMultiplier()Returns how much it has been multiplied by shift-clicking.It's always 1 by default when not shift clicked. - Returns:
- How many he tries to buy
 
- 
setMultiplierpublic void setMultiplier(int multiplier) Set how often/many items he should receive the item.- Parameters:
- multiplier- The new multiplier value
- Throws:
- IllegalArgumentException- When the new value is less than 1
 
- 
getProblemsReturns the problems that are preventing the item from being bought- Returns:
- The problems
 
- 
addProblemAdd a problem that will prevent the item from being bought.Act's similar as Cancellable.setCancelled(boolean).- Parameters:
- problem- The problem why he can't buy it
- Returns:
- falseif it already has been added
 
- 
addProblemAdd a problem that will prevent the item from being bought.Act's similar as Cancellable.setCancelled(boolean).- Parameters:
- problem- The problem why he can't buy it
- Returns:
- falseif it already has been added
 
- 
removeProblemRemoves a problem.- Parameters:
- problem- The problem
- Returns:
- If it has been removed or not
 
- 
removeProblemRemoves a problem.- Parameters:
- problem- The problem
- Returns:
- If it has been removed or not
 
- 
removeAllProblemspublic int removeAllProblems()Removes all problems and makes it buyable by that.- Returns:
- The amount of problems that have been removed
 
- 
isGivingProductspublic boolean isGivingProducts()Returns whether or not the player will receive the products of the item.Does not concern when there are problems as he won't receive them if there are problems anyways. - Returns:
- If he'll get the products or not
 
- 
setGivingProductspublic void setGivingProducts(boolean giveProducts) Define whether or not if he'll get products.Keep in mind that problems can prevent products being given to him. - Parameters:
- giveProducts- The new value
 
- 
isTakingPaymentspublic boolean isTakingPayments()Returns whether or not the it'll take the payments from the player.Does not concern when there are problems as they're preventing them from being taken anyways. - Returns:
- If the payments will be taken or not
 
- 
setTakingPaymentspublic void setTakingPayments(boolean takePayments) Define whether or not the payments will be taken from the player.Keep in mind that problems can prevent this - Parameters:
- takePayments- The new value
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-