aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch
new file mode 100644
index 0000000000..83c81e405f
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/PlayerAdvancements.java.patch
@@ -0,0 +1,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);
+ }
+ });
+ }