aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2023-11-04 14:11:55 -0700
committerGitHub <[email protected]>2023-11-04 14:11:55 -0700
commit0cdce89d595a2c1c097c9e2a5ff96687977b3b25 (patch)
treede63d6aa8112811f93b5d6afebbb069b9980870f /patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
parent15a0de2eefb70ea8162cbb31056920adf80265fa (diff)
downloadPaper-0cdce89d595a2c1c097c9e2a5ff96687977b3b25.tar.gz
Paper-0cdce89d595a2c1c097c9e2a5ff96687977b3b25.zip
Fix a bunch of stuff with player spawn locations (#9887)
If a playerdata doesn't contain a valid, loaded world, reset to the main world spawn point
Diffstat (limited to 'patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch')
-rw-r--r--patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
new file mode 100644
index 0000000000..85efd06d0c
--- /dev/null
+++ b/patches/server/0590-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
@@ -0,0 +1,31 @@
+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 d03db10517b2df98b40ab48e450333960508aabf..e38e2e5a7ddba9c140f362021b6be0b0974f7cd1 100644
+--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
++++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
+@@ -237,11 +237,17 @@ 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 -> java.util.Optional.ofNullable(info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + info.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement))) : 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(Component.translatable("chat.type.advancement." + advancementdisplay.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement)), 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
+ }
+
+ });