fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846)
Dieser Commit ist enthalten in:
Ursprung
8b1ac39e89
Commit
c6fac381ed
@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/
|
||||
index 4d66a9f24d718de4c6862b20ccb7240332523db4..6b31f88803041c75023a2c99bdc1efd902f0205c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -319,7 +319,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -319,7 +319,27 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
JsonObject jsonobject = GsonHelper.convertToJsonObject(jsonelement, "advancement");
|
||||
net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.fromJson(jsonobject, new DeserializationContext(minecraftkey, MinecraftServer.getServer().getLootData()));
|
||||
if (nms != null) {
|
||||
@ -22,7 +22,17 @@ index 4d66a9f24d718de4c6862b20ccb7240332523db4..6b31f88803041c75023a2c99bdc1efd9
|
||||
+ mapBuilder.put(minecraftkey, holder);
|
||||
+
|
||||
+ MinecraftServer.getServer().getAdvancements().advancements = mapBuilder.build();
|
||||
+ MinecraftServer.getServer().getAdvancements().tree().addAll(List.of(holder));
|
||||
+ final net.minecraft.advancements.AdvancementTree tree = MinecraftServer.getServer().getAdvancements().tree();
|
||||
+ tree.addAll(List.of(holder));
|
||||
+
|
||||
+ // recalculate advancement position
|
||||
+ final net.minecraft.advancements.AdvancementNode node = tree.get(minecraftkey);
|
||||
+ if (node != null) {
|
||||
+ final net.minecraft.advancements.AdvancementNode root = node.root();
|
||||
+ if (root.holder().value().display().isPresent()) {
|
||||
+ net.minecraft.advancements.TreeNodePosition.run(root);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - Fix throw UnsupportedOperationException
|
||||
Advancement bukkit = Bukkit.getAdvancement(key);
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren