Files
Purpur/patches/server/0079-Add-LootableInventoryFirstFillEvent.patch
William Blake Galbreath 8ec7d99ec0 Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
a6ac47e5 Fix numerous item duplication issues and teleport issues
b7402f11 Add phantom creative and insomniac controls (#3222)
75819fac Fix Potion#toItemStack swapping the extended and upgraded constructor values (#3216)
2020-04-25 15:48:09 -05:00

45 lines
2.4 KiB
Diff

From 777ed70875da2cdd96612f950004769d586d1271 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 | 4 ++++
.../paper/loottable/PaperTileEntityLootableInventory.java | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
index b5401eaf9..1decf0e89 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -49,6 +49,10 @@ public class PaperLootableInventoryData {
// ALWAYS process the first fill or if the feature is disabled
if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
+ // Purpur start
+ LootableInventory inventory = lootable.getAPILootableInventory();
+ if (inventory != null) new net.pl3x.purpur.event.block.LootableInventoryFirstFillEvent(player == null ? null : (Player) player.getBukkitEntity(), inventory).callEvent();
+ // Purpur end
return true;
}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
index d50410532..2f24e5a70 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
@@ -57,7 +57,10 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
if (world == null) {
return null;
}
- return (LootableInventory) getBukkitWorld().getBlockAt(MCUtil.toLocation(world, tileEntityLootable.getPosition())).getState();
+ // Purpur start
+ org.bukkit.block.BlockState state = getBukkitWorld().getBlockAt(MCUtil.toLocation(world, tileEntityLootable.getPosition())).getState();
+ return state instanceof LootableInventory ? (LootableInventory) state : null;
+ // Purpur end
}
@Override
--
2.24.0