mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
some patches :D
This commit is contained in:
parent
7725b39a8f
commit
20f31c62d2
@ -14,14 +14,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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 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(Component.translatable("chat.type.advancement." + advancementdisplay.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement)), false);
|
||||
- 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);
|
Loading…
Reference in New Issue
Block a user