From 0715ac2dba230a1231c484bea93d1f6b80bcdaa8 Mon Sep 17 00:00:00 2001 From: NichtStudioCode <51272202+NichtStudioCode@users.noreply.github.com> Date: Sat, 8 May 2021 21:49:50 +0200 Subject: [PATCH] Make VirtualInventory#notifyWindows public --- .../invui/virtualinventory/VirtualInventory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/studiocode/invui/virtualinventory/VirtualInventory.java b/src/main/java/de/studiocode/invui/virtualinventory/VirtualInventory.java index 7a51dee..ed59a2f 100644 --- a/src/main/java/de/studiocode/invui/virtualinventory/VirtualInventory.java +++ b/src/main/java/de/studiocode/invui/virtualinventory/VirtualInventory.java @@ -537,7 +537,13 @@ public class VirtualInventory implements ConfigurationSerializable { windows.remove(window); } - private void notifyWindows() { + /** + * Notifies all {@link Window}s displaying this {@link VirtualInventory} to update their + * representative {@link ItemStack}s. + * This method should only be called manually in very specific cases like when the + * {@link ItemMeta} of an {@link ItemStack} in this inventory has changed. + */ + public void notifyWindows() { Bukkit.getScheduler().runTask(InvUI.getInstance().getPlugin(), () -> windows.forEach(window -> window.handleVirtualInventoryUpdate(this))); }