From 5bd61ce801712db9035cbb078eafcfa2314ec830 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 17 May 2024 14:22:45 -0700 Subject: [PATCH] Fix NPE sending resource pack without prompt Fixes KyoriPowered/adventure#1075 --- patches/server/Adventure.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 1795324ea91..4bd6545b8d9 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -4317,7 +4317,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final Component prompt = io.papermc.paper.adventure.PaperAdventure.asVanilla(request.prompt()); + for (final java.util.Iterator iter = request.packs().iterator(); iter.hasNext();) { + final net.kyori.adventure.resource.ResourcePackInfo pack = iter.next(); -+ packs.add(new ClientboundResourcePackPushPacket(pack.id(), pack.uri().toASCIIString(), pack.hash(), request.required(), iter.hasNext() ? Optional.empty() : Optional.of(prompt))); ++ packs.add(new ClientboundResourcePackPushPacket(pack.id(), pack.uri().toASCIIString(), pack.hash(), request.required(), iter.hasNext() ? Optional.empty() : Optional.ofNullable(prompt))); + if (request.callback() != net.kyori.adventure.resource.ResourcePackCallback.noOp()) { + this.getHandle().connection.packCallbacks.put(pack.id(), request.callback()); // just override if there is a previously existing callback + }