Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
36 Zeilen
2.7 KiB
Diff
36 Zeilen
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com>
|
|
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 6e0073a54f59621d8adb4e8a70e6c89c708eabba..24e5993b281448734eb67c7a8439a349bbf9fd72 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
|
|
}
|
|
|
|
});
|