diff --git a/patches/api/0399-Add-PlayerInventorySlotChangeEvent.patch b/patches/api/0399-Add-PlayerInventorySlotChangeEvent.patch index 7992e41c1..286b6f39c 100644 --- a/patches/api/0399-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/api/0399-Add-PlayerInventorySlotChangeEvent.patch @@ -4,13 +4,13 @@ Date: Sun, 24 Apr 2022 22:56:31 +0200 Subject: [PATCH] Add PlayerInventorySlotChangeEvent -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInventorySlotChangeEvent.java +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..f106d2c6fb349c57ed00f1d7f96efacb1ade3959 +index 0000000000000000000000000000000000000000..e86443b3b2e17f95be483acc06593212d9eefc03 --- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInventorySlotChangeEvent.java ++++ b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java @@ -0,0 +1,84 @@ -+package com.destroystokyo.paper.event.player; ++package io.papermc.paper.event.player; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; @@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..f106d2c6fb349c57ed00f1d7f96efacb + * + * @return Whether the slot change advancements will be triggered. + */ -+ public boolean isTriggerAdvancements() { ++ public boolean shouldTriggerAdvancements() { + return triggerAdvancements; + } + @@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..f106d2c6fb349c57ed00f1d7f96efacb + * + * @param triggerAdvancements Whether the slot change advancements will be triggered. + */ -+ public void setTriggerAdvancements(boolean triggerAdvancements) { ++ public void setShouldTriggerAdvancements(boolean triggerAdvancements) { + this.triggerAdvancements = triggerAdvancements; + } + diff --git a/patches/server/0925-Add-PlayerInventorySlotChangeEvent.patch b/patches/server/0925-Add-PlayerInventorySlotChangeEvent.patch index a0f06b8fa..4c38d4e32 100644 --- a/patches/server/0925-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/0925-Add-PlayerInventorySlotChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index af7acb628b84539b1ee5ef1934f75f091c4cd91e..e5af7ef4ada68922a70f593ccec555ecb50627a9 100644 +index af7acb628b84539b1ee5ef1934f75f091c4cd91e..961d25bbf868438bf5e5257bad745c8208a01171 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -318,6 +318,25 @@ public class ServerPlayer extends Player { @@ -18,13 +18,13 @@ index af7acb628b84539b1ee5ef1934f75f091c4cd91e..e5af7ef4ada68922a70f593ccec555ec + Slot slot = handler.getSlot(slotId); + if (!(slot instanceof ResultSlot)) { + if (slot.container == ServerPlayer.this.getInventory()) { -+ if (com.destroystokyo.paper.event.player.PlayerInventorySlotChangeEvent.getHandlerList().getRegisteredListeners().length == 0) { ++ if (io.papermc.paper.event.player.PlayerInventorySlotChangeEvent.getHandlerList().getRegisteredListeners().length == 0) { + CriteriaTriggers.INVENTORY_CHANGED.trigger(ServerPlayer.this, ServerPlayer.this.getInventory(), stack); + return; + } -+ com.destroystokyo.paper.event.player.PlayerInventorySlotChangeEvent event = new com.destroystokyo.paper.event.player.PlayerInventorySlotChangeEvent(ServerPlayer.this.getBukkitEntity(), slotId, CraftItemStack.asBukkitCopy(oldStack), CraftItemStack.asBukkitCopy(stack)); ++ io.papermc.paper.event.player.PlayerInventorySlotChangeEvent event = new io.papermc.paper.event.player.PlayerInventorySlotChangeEvent(ServerPlayer.this.getBukkitEntity(), slotId, CraftItemStack.asBukkitCopy(oldStack), CraftItemStack.asBukkitCopy(stack)); + event.callEvent(); -+ if (event.isTriggerAdvancements()) { ++ if (event.shouldTriggerAdvancements()) { + CriteriaTriggers.INVENTORY_CHANGED.trigger(ServerPlayer.this, ServerPlayer.this.getInventory(), stack); + } + }