mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Fix package for PlayerInventorySlotChangeEvent (#8475)
Co-authored-by: Jakub Zacek <dawon@dawon.eu>
This commit is contained in:
parent
a35758c72d
commit
fc419cfa50
@ -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..0000000000000000000000000000000000000000
|
||||
--- /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 +0,0 @@
|
||||
+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..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return Whether the slot change advancements will be triggered.
|
||||
+ */
|
||||
+ public boolean isTriggerAdvancements() {
|
||||
+ public boolean shouldTriggerAdvancements() {
|
||||
+ return triggerAdvancements;
|
||||
+ }
|
||||
+
|
||||
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @param triggerAdvancements Whether the slot change advancements will be triggered.
|
||||
+ */
|
||||
+ public void setTriggerAdvancements(boolean triggerAdvancements) {
|
||||
+ public void setShouldTriggerAdvancements(boolean triggerAdvancements) {
|
||||
+ this.triggerAdvancements = triggerAdvancements;
|
||||
+ }
|
||||
+
|
||||
|
@ -18,13 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user