diff options
author | Jake Potrebic <[email protected]> | 2024-05-17 14:22:45 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-05-17 14:22:45 -0700 |
commit | d8d59e0cdeda3f7e9da337b6d489f306fc5e76c9 (patch) | |
tree | 8a19a6189114f0af1ede57391023707c33862644 | |
parent | f17519338bc589c045e0b32bfc37e048b23544d5 (diff) | |
download | Paper-d8d59e0cdeda3f7e9da337b6d489f306fc5e76c9.tar.gz Paper-d8d59e0cdeda3f7e9da337b6d489f306fc5e76c9.zip |
Fix NPE sending resource pack without prompt
Fixes KyoriPowered/adventure#1075
-rw-r--r-- | patches/server/0010-Adventure.patch | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index f83b3b6f40..8d953d0033 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -4098,7 +4098,7 @@ index 55945b83a5426b352bad9507cc9e94afb1278032..9ea1537408ff2d790747b6e5a681d917 public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 654d4994bb2e65c5ca6b7190c15d2113eede9e5b..1c1f1db8cb8beff850103d998561d333823fe611 100644 +index 654d4994bb2e65c5ca6b7190c15d2113eede9e5b..4d1e8a9211462444543b4a16cefe369245e71b2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -386,14 +386,40 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -4317,7 +4317,7 @@ index 654d4994bb2e65c5ca6b7190c15d2113eede9e5b..1c1f1db8cb8beff850103d998561d333 + final Component prompt = io.papermc.paper.adventure.PaperAdventure.asVanilla(request.prompt()); + for (final java.util.Iterator<net.kyori.adventure.resource.ResourcePackInfo> 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 + } @@ -5552,7 +5552,7 @@ index 64191fb2f238c6dacf894d88a703ced6e75a6054..cb6cc3896e862291a058d21fa9704dd1 boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 8a13d8ae4325854acb3be7083d022c08ba094df1..311b4472f955cba658afa763b2f0b31023b53236 100644 +index 951f76eff07e53af20105b29a4e3c81b78ef8b65..cac2bfc711daba11a640e4e776b10c86041b0670 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -80,6 +80,43 @@ public final class CraftMagicNumbers implements UnsafeValues { |