mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 15:17:17 +01:00
Fix NPE sending resource pack without prompt
Fixes KyoriPowered/adventure#1075
This commit is contained in:
parent
f17519338b
commit
d8d59e0cde
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue