mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
1e38743b1d
Also fixes build as a result of an upstream force push --- work/Bukkit Submodule work/Bukkit 217dc08d..d13fdf8c: > SPIGOT-4637: Add source block to BlockPhysicsEvent. --- work/CraftBukkit Submodule work/CraftBukkit acbba8ba..cb98c6ea: > Fix line endings in CraftDefaultPermissions > SPIGOT-4637: Add source block to BlockPhysicsEvent. --- work/Spigot Submodule work/Spigot 75ee78a0c...4165cd8f4 (commits not present) > (Manually Added) - Appears to be a result of an upstream force push > (Manually Added) - Changed: SPIGOT-4636: Add creative mode NBT permissions
47 lines
2.0 KiB
Diff
47 lines
2.0 KiB
Diff
From 1bfc074d3d5ff315ef835d271dd27b223a18967f 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 23389743d..d25928e09 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryCreator.java
|
|
@@ -31,10 +31,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.20.1
|
|
|