aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch
blob: 83c81e405f72d328b9c3b8c09cf6b4acfe37a03c (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
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -142,11 +191,13 @@
         }
     }
 
-    private void applyFrom(ServerAdvancementManager serverAdvancementManager, PlayerAdvancements.Data data) {
-        data.forEach((resourceLocation, advancementProgress) -> {
-            AdvancementHolder advancementHolder = serverAdvancementManager.get(resourceLocation);
-            if (advancementHolder == null) {
-                LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", resourceLocation, this.playerSavePath);
+    private void applyFrom(ServerAdvancementManager advancementdataworld, PlayerAdvancements.a advancementdataplayer_a) {
+        advancementdataplayer_a.forEach((minecraftkey, advancementprogress) -> {
+            AdvancementHolder advancementholder = advancementdataworld.get(minecraftkey);
+
+            if (advancementholder == null) {
+                if (!minecraftkey.getNamespace().equals("minecraft")) return; // CraftBukkit
+                PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
             } else {
                 this.startProgress(advancementHolder, advancementProgress);
                 this.progressChanged.add(advancementHolder);
@@ -173,11 +227,12 @@
             this.unregisterListeners(advancementHolder);
             this.progressChanged.add(advancementHolder);
             flag = true;
-            if (!isDone && orStartProgress.isDone()) {
-                advancementHolder.value().rewards().grant(this.player);
-                advancementHolder.value().display().ifPresent(displayInfo -> {
-                    if (displayInfo.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
-                        this.playerList.broadcastSystemMessage(displayInfo.getType().createAnnouncement(advancementHolder, this.player), false);
+            if (!flag1 && advancementprogress.isDone()) {
+                this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancementholder.toBukkit())); // CraftBukkit
+                advancementholder.value().rewards().grant(this.player);
+                advancementholder.value().display().ifPresent((advancementdisplay) -> {
+                    if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+                        this.playerList.broadcastSystemMessage(advancementdisplay.getType().createAnnouncement(advancementholder, this.player), false);
                     }
                 });
             }