Package io.papermc.paper.event.player

# Class PlayerTradeEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerPurchaseEvent
io.papermc.paper.event.player.PlayerTradeEvent

All Implemented Interfaces:
  `Cancellable`

public class PlayerTradeEvent extends PlayerPurchaseEvent
Called when a player trades with a villager or wandering trader

## 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

Constructors
Constructor
Description
`PlayerTradeEvent(@NotNull Player player, @NotNull AbstractVillager villager, @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses)`

## Method Summary

Modifier and Type
Method
Description
`@NotNull AbstractVillager`
`getVillager()`
Gets the Villager or Wandering trader associated with this event

### Methods inherited from class io.papermc.paper.event.player.PlayerPurchaseEvent

`getHandlerList, getHandlers, getTrade, isCancelled, isRewardingExp, setCancelled, setIncreaseTradeUses, setRewardExp, setTrade, willIncreaseTradeUses`

### Methods inherited from class org.bukkit.event.player.PlayerEvent

`getPlayer`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlayerTradeEvent

public PlayerTradeEvent(@NotNull @NotNull Player player, @NotNull @NotNull AbstractVillager villager, @NotNull @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses)

## Method Details

### getVillager

@NotNull public @NotNull AbstractVillager getVillager()
Gets the Villager or Wandering trader associated with this event

Returns:
  the villager or wandering trader