summaryrefslogtreecommitdiffstats
path: root/nms-patches/AdvancementDataPlayer.patch
blob: 3030c6065b2dcb58cb31524ebdf1ad5e56045fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -38,7 +38,7 @@
 
     private static final Logger a = LogManager.getLogger();
     private static final Gson b = (new GsonBuilder()).registerTypeAdapter(AdvancementProgress.class, new AdvancementProgress.a()).registerTypeAdapter(MinecraftKey.class, new MinecraftKey.a()).setPrettyPrinting().create();
-    private static final TypeToken<Map<MinecraftKey, AdvancementProgress>> c = new TypeToken() {
+    private static final TypeToken<Map<MinecraftKey, AdvancementProgress>> c = new TypeToken<Map<MinecraftKey, AdvancementProgress>>() { // CraftBukkit - decompile error
     };
     private final MinecraftServer d;
     private final File e;
@@ -100,7 +100,7 @@
         Iterator iterator = this.data.entrySet().iterator();
 
         while (iterator.hasNext()) {
-            Entry entry = (Entry) iterator.next();
+            Entry<Advancement, AdvancementProgress> entry = (Entry) iterator.next(); // CraftBukkit - decompile error
 
             if (((AdvancementProgress) entry.getValue()).isDone()) {
                 arraylist.add(entry.getKey());
@@ -140,7 +140,7 @@
 
                 try {
                     jsonreader.setLenient(false);
-                    Dynamic dynamic = new Dynamic(JsonOps.INSTANCE, Streams.parse(jsonreader));
+                    Dynamic<?> dynamic = new Dynamic(JsonOps.INSTANCE, Streams.parse(jsonreader)); // CraftBukkit - decompile error
 
                     if (!dynamic.get("DataVersion").flatMap(Dynamic::getNumberValue).isPresent()) {
                         dynamic = dynamic.set("DataVersion", dynamic.createInt(1343));
@@ -148,7 +148,7 @@
 
                     dynamic = this.d.az().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1631);
                     dynamic = dynamic.remove("DataVersion");
-                    Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue());
+                    Map<MinecraftKey, AdvancementProgress> map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); // CraftBukkit - decompile error
 
                     if (map == null) {
                         throw new JsonParseException("Found null for advancements");
@@ -162,7 +162,11 @@
                         Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey());
 
                         if (advancement == null) {
-                            AdvancementDataPlayer.a.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e);
+                            // CraftBukkit start
+                            if (((MinecraftKey) entry.getKey()).b().equals("minecraft")) {
+                                AdvancementDataPlayer.a.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e);
+                            }
+                            // CraftBukkit end
                         } else {
                             this.a(advancement, (AdvancementProgress) entry.getValue());
                         }
@@ -231,6 +235,7 @@
             this.i.add(advancement);
             flag = true;
             if (!flag1 && advancementprogress.isDone()) {
+                this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
                 advancement.d().a(this.player);
                 if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean("announceAdvancements")) {
                     this.d.getPlayerList().sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[] { this.player.getScoreboardDisplayName(), advancement.j()}));