mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Add LootableInventoryFirstFillEvent
This commit is contained in:
61
patches/api/0024-Add-LootableInventoryFirstFillEvent.patch
Normal file
61
patches/api/0024-Add-LootableInventoryFirstFillEvent.patch
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
From d47862fed3c83222dbc36271b1c447324d20e771 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Sat, 19 Oct 2019 02:43:10 -0500
|
||||||
|
Subject: [PATCH] Add LootableInventoryFirstFillEvent
|
||||||
|
|
||||||
|
---
|
||||||
|
.../LootableInventoryFirstFillEvent.java | 42 +++++++++++++++++++
|
||||||
|
1 file changed, 42 insertions(+)
|
||||||
|
create mode 100644 src/main/java/net/pl3x/purpur/event/block/LootableInventoryFirstFillEvent.java
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/pl3x/purpur/event/block/LootableInventoryFirstFillEvent.java b/src/main/java/net/pl3x/purpur/event/block/LootableInventoryFirstFillEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..ef8eafb7c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/pl3x/purpur/event/block/LootableInventoryFirstFillEvent.java
|
||||||
|
@@ -0,0 +1,42 @@
|
||||||
|
+package net.pl3x.purpur.event.block;
|
||||||
|
+
|
||||||
|
+import com.destroystokyo.paper.loottable.LootableInventory;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+import org.jetbrains.annotations.Nullable;
|
||||||
|
+
|
||||||
|
+public class LootableInventoryFirstFillEvent extends Event {
|
||||||
|
+ @Nullable
|
||||||
|
+ private final Player player;
|
||||||
|
+ @NotNull
|
||||||
|
+ private final LootableInventory inventory;
|
||||||
|
+
|
||||||
|
+ public LootableInventoryFirstFillEvent(@Nullable Player player, @NotNull LootableInventory inventory) {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.inventory = inventory;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Nullable
|
||||||
|
+ public Player getPlayer() {
|
||||||
|
+ return player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public LootableInventory getInventory() {
|
||||||
|
+ return inventory;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public HandlerList getHandlers() {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public static HandlerList getHandlerList() {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.23.0.rc1
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
From c6e2d30bdaef92215c2204407b3fbdfb1a7135a1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Sat, 19 Oct 2019 02:43:17 -0500
|
||||||
|
Subject: [PATCH] Add LootableInventoryFirstFillEvent
|
||||||
|
|
||||||
|
---
|
||||||
|
.../paper/loottable/PaperLootableInventoryData.java | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
|
index b5401eaf97..25a92d4bb8 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
|
@@ -49,6 +49,7 @@ public class PaperLootableInventoryData {
|
||||||
|
|
||||||
|
// ALWAYS process the first fill or if the feature is disabled
|
||||||
|
if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
|
||||||
|
+ new net.pl3x.purpur.event.block.LootableInventoryFirstFillEvent(player == null ? null : (Player) player.getBukkitEntity(), lootable.getAPILootableInventory()); // Purpur
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0.rc1
|
||||||
|
|
||||||
Reference in New Issue
Block a user