aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0222-Added-PlayerTradeEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0222-Added-PlayerTradeEvent.patch')
-rw-r--r--patches/api/0222-Added-PlayerTradeEvent.patch33
1 files changed, 14 insertions, 19 deletions
diff --git a/patches/api/0222-Added-PlayerTradeEvent.patch b/patches/api/0222-Added-PlayerTradeEvent.patch
index 11ad019021..92c8312a01 100644
--- a/patches/api/0222-Added-PlayerTradeEvent.patch
+++ b/patches/api/0222-Added-PlayerTradeEvent.patch
@@ -13,10 +13,10 @@ event being about villager trades.
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java
new file mode 100644
-index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43e9b50bfc
+index 0000000000000000000000000000000000000000..1691b53f157f17117116e841cbfc769ea0e14364
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java
-@@ -0,0 +1,109 @@
+@@ -0,0 +1,104 @@
+package io.papermc.paper.event.player;
+
+import com.google.common.base.Preconditions;
@@ -26,11 +26,12 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.MerchantRecipe;
+import org.jetbrains.annotations.ApiStatus;
-+import org.jetbrains.annotations.NotNull;
++import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when a player trades with a standalone merchant GUI.
+ */
++@NullMarked
+public class PlayerPurchaseEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -42,12 +43,9 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ private boolean cancelled;
+
+ @ApiStatus.Internal
-+ public PlayerPurchaseEvent(@NotNull Player player,
-+ @NotNull MerchantRecipe trade,
-+ boolean rewardExp,
-+ boolean increaseTradeUses) {
++ public PlayerPurchaseEvent(final Player player, final MerchantRecipe trade, final boolean rewardExp, final boolean increaseTradeUses) {
+ super(player);
-+ setTrade(trade);
++ this.trade = trade;
+ this.rewardExp = rewardExp;
+ this.increaseTradeUses = increaseTradeUses;
+ }
@@ -57,7 +55,6 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ *
+ * @return the trade
+ */
-+ @NotNull
+ public MerchantRecipe getTrade() {
+ return this.trade;
+ }
@@ -67,7 +64,7 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ *
+ * @param trade the trade to use
+ */
-+ public void setTrade(@NotNull MerchantRecipe trade) {
++ public void setTrade(final MerchantRecipe trade) {
+ Preconditions.checkArgument(trade != null, "Trade cannot be null!");
+ this.trade = trade;
+ }
@@ -84,7 +81,7 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ *
+ * @param rewardExp try to reward exp
+ */
-+ public void setRewardExp(boolean rewardExp) {
++ public void setRewardExp(final boolean rewardExp) {
+ this.rewardExp = rewardExp;
+ }
+
@@ -100,7 +97,7 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ *
+ * @param increaseTradeUses {@code true} to count, {@code false} otherwise
+ */
-+ public void setIncreaseTradeUses(boolean increaseTradeUses) {
++ public void setIncreaseTradeUses(final boolean increaseTradeUses) {
+ this.increaseTradeUses = increaseTradeUses;
+ }
+
@@ -110,17 +107,15 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+ }
+
+ @Override
-+ public void setCancelled(boolean cancel) {
++ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
-+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
-+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
@@ -128,7 +123,7 @@ index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43
+}
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java
new file mode 100755
-index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0888890ac
+index 0000000000000000000000000000000000000000..46bdc178c19feb7dbb71eebee6d0774cf16c1042
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java
@@ -0,0 +1,32 @@
@@ -138,17 +133,18 @@ index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.MerchantRecipe;
+import org.jetbrains.annotations.ApiStatus;
-+import org.jetbrains.annotations.NotNull;
++import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when a player trades with a villager or wandering trader
+ */
++@NullMarked
+public class PlayerTradeEvent extends PlayerPurchaseEvent {
+
+ private final AbstractVillager villager;
+
+ @ApiStatus.Internal
-+ public PlayerTradeEvent(@NotNull Player player, @NotNull AbstractVillager villager, @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses) {
++ public PlayerTradeEvent(final Player player, final AbstractVillager villager, final MerchantRecipe trade, final boolean rewardExp, final boolean increaseTradeUses) {
+ super(player, trade, rewardExp, increaseTradeUses);
+ this.villager = villager;
+ }
@@ -158,7 +154,6 @@ index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0
+ *
+ * @return the villager or wandering trader
+ */
-+ @NotNull
+ public AbstractVillager getVillager() {
+ return this.villager;
+ }