diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java index 6f7d180de..9985e1e48 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java @@ -52,9 +52,15 @@ public class FormCache { return windowId; } - public int showForm(Form form) { + public void showForm(Form form) { int windowId = addForm(form); + if (session.getUpstream().isInitialized()) { + sendForm(windowId, form); + } + } + + private void sendForm(int windowId, Form form) { ModalFormRequestPacket formRequestPacket = new ModalFormRequestPacket(); formRequestPacket.setFormId(windowId); formRequestPacket.setFormData(form.getJsonData()); @@ -68,8 +74,12 @@ public class FormCache { session.scheduleInEventLoop(() -> session.sendUpstreamPacket(latencyPacket), 500, TimeUnit.MILLISECONDS); } + } - return windowId; + public void resendAllForms() { + for (Int2ObjectMap.Entry