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

Paper Changes:
b75eeca0 Boost light task priority to ensure it doesnt hold up chunk loads
3d2bc848 Ensure VillagerTrades doesn't load async - fixes #3495
e470f1ef Add more information to Timing Reports
f4a47db6 Improve Thread Pool usage to allow single threads for single cpu servers
a4fe910f Fix sounds when using worldedit regen command
70ad51a8 Updated Upstream (Bukkit/CraftBukkit)
d7cfa4fa Improve legacy format serialization more
2020-06-05 21:42:48 -05:00

45 lines
2.4 KiB
Diff

From 2430d722450bbd7540f860b986524d670f9b0c49 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 b5401eaf97..1decf0e895 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 d50410532c..2f24e5a702 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