Package io.papermc.paper.event.player
Class PlayerPurchaseEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerPurchaseEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
PlayerTradeEvent
Called when a player trades with a standalone merchant GUI.
-
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
ConstructorsConstructorDescriptionPlayerPurchaseEvent(Player player, MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListgetTrade()Gets the associated trade with this eventbooleanGets the cancellation state of this event.booleanvoidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetIncreaseTradeUses(boolean increaseTradeUses) Sets whether the trade will count as a usevoidsetRewardExp(boolean rewardExp) Sets whether the trade will try to reward expvoidsetTrade(MerchantRecipe trade) Sets the trade.booleanMethods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerPurchaseEvent
@Internal public PlayerPurchaseEvent(Player player, MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses)
-
-
Method Details
-
getTrade
Gets the associated trade with this event- Returns:
- the trade
-
setTrade
Sets the trade. This is then used to determine the next prices- Parameters:
trade- the trade to use
-
isRewardingExp
public boolean isRewardingExp()- Returns:
- will trade try to reward exp
-
setRewardExp
public void setRewardExp(boolean rewardExp) Sets whether the trade will try to reward exp- Parameters:
rewardExp- try to reward exp
-
willIncreaseTradeUses
public boolean willIncreaseTradeUses()- Returns:
- whether the trade will count as a use of the trade
-
setIncreaseTradeUses
public void setIncreaseTradeUses(boolean increaseTradeUses) Sets whether the trade will count as a use- Parameters:
increaseTradeUses-trueto count,falseotherwise
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-