mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 20:21:51 +01:00
e4d10a6d67
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType() CraftBukkit Changes:bbe3d58e
SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException3075579f
Add FaceAttachable interface to handle Grindstone facing in common with Switches95bd4238
SPIGOT-5647: ZombieVillager entity should have getVillagerType()4d975ac3
SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
46 lines
2 KiB
Diff
46 lines
2 KiB
Diff
From 53393b9aea966f8b9a8fd2b125c21649ef1df8fc Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Mon, 5 Nov 2018 04:23:51 +0000
|
|
Subject: [PATCH] Restore custom InventoryHolder support
|
|
|
|
Upstream removed the ability to consistently use a custom InventoryHolder,
|
|
However, the implementation does not use an InventoryHolder in any form
|
|
outside of custom inventories.
|
|
|
|
We can take that knowledge and apply some expected behavior, if we're given
|
|
an inventory holder, we should use it and return a custom inventory with the
|
|
holder, otherwise, create an inventory backed by the intended inventory, as
|
|
per upstream behavior.
|
|
|
|
This provides a "best of both worlds" scenario: plugins with InventoryHolder's
|
|
will always work as intended in the past, those without will create implementation
|
|
based inventories.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java
|
|
index 9957ed0402..ae280dd40b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java
|
|
@@ -39,10 +39,20 @@ public final class CraftInventoryCreator {
|
|
}
|
|
|
|
public Inventory createInventory(InventoryHolder holder, InventoryType type) {
|
|
+ // Paper start
|
|
+ if (holder != null) {
|
|
+ return DEFAULT_CONVERTER.createInventory(holder, type);
|
|
+ }
|
|
+ //noinspection ConstantConditions // Paper end
|
|
return converterMap.get(type).createInventory(holder, type);
|
|
}
|
|
|
|
public Inventory createInventory(InventoryHolder holder, InventoryType type, String title) {
|
|
+ // Paper start
|
|
+ if (holder != null) {
|
|
+ return DEFAULT_CONVERTER.createInventory(holder, type, title);
|
|
+ }
|
|
+ //noinspection ConstantConditions // Paper end
|
|
return converterMap.get(type).createInventory(holder, type, title);
|
|
}
|
|
|
|
--
|
|
2.25.1
|
|
|