diff options
author | Jason Penilla <[email protected]> | 2024-04-27 13:27:01 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-04-27 13:27:01 -0700 |
commit | e2552eea2481871c9d8445a3c5653a2329112648 (patch) | |
tree | 727c90f395576b66200f8d9e59f38859f3850562 /patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch | |
parent | 0b1b1fe067444c5e879313e017da0ffd5d6b826d (diff) | |
download | Paper-e2552eea2481871c9d8445a3c5653a2329112648.tar.gz Paper-e2552eea2481871c9d8445a3c5653a2329112648.zip |
Start cleaning up plugin remapping patches
Diffstat (limited to 'patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch')
-rw-r--r-- | patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch new file mode 100644 index 0000000000..839c465c9c --- /dev/null +++ b/patches/server/0541-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alvinn8 <[email protected]> +Date: Fri, 8 Jan 2021 20:31:13 +0100 +Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent + + +diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java +index f46fa0fbfec19904d21729847788c6c624a3e97f..c7e1f2bac3eca9bb72bf1f8c26cccb2905e1ddfc 100644 +--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java ++++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +@@ -236,11 +236,21 @@ public class PlayerAdvancements { + this.progressChanged.add(advancement); + flag = true; + if (!flag1 && advancementprogress.isDone()) { +- this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit())); // CraftBukkit ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ final net.kyori.adventure.text.Component message = advancement.value().display().flatMap(info -> { ++ return java.util.Optional.ofNullable( ++ info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(info.getType().createAnnouncement(advancement, this.player)) : null ++ ); ++ }).orElse(null); ++ final org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit(), message); ++ this.player.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ // Paper end + advancement.value().rewards().grant(this.player); + advancement.value().display().ifPresent((advancementdisplay) -> { +- if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { +- this.playerList.broadcastSystemMessage(advancementdisplay.getType().createAnnouncement(advancement, this.player), false); ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { ++ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); ++ // Paper end + } + + }); |