Paper/patches/api/0278-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
Nassim Jahnke 71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00

72 lines
2.6 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:29:58 +0100
Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
index 21ff095afb434d15babcdbe85fa0b94cbb7e75a7..6f618bb140a901c5c1cd08210978a6a651677ba4 100644
--- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
@@ -4,6 +4,10 @@ import org.bukkit.advancement.Advancement;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+// Paper start
+import org.jetbrains.annotations.Nullable;
+import net.kyori.adventure.text.Component;
+// Paper end
/**
* Called when a player has completed all criteria in an advancement.
@@ -13,10 +17,17 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
//
private final Advancement advancement;
+ private Component message; // Paper - Add Adventure message
public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement) {
+ // Paper start - Add Adventure message
+ this(who, advancement, null);
+ }
+ public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement, @Nullable Component message) {
+ // Paper end
super(who);
this.advancement = advancement;
+ this.message = message; // Paper - Add Adventure message
}
/**
@@ -29,6 +40,31 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent {
return advancement;
}
+ // Paper start - Add Adventure message
+ /**
+ * Gets the message to send to all online players.
+ * <p>
+ * Will be null if the advancement does not announce to chat, for example if
+ * it is a recipe unlock or a root advancement.
+ *
+ * @return The announcement message, or null
+ */
+ @Nullable
+ public Component message() {
+ return this.message;
+ }
+
+ /**
+ * Sets the message to send to all online players.
+ * <p>
+ * If set to null the message will not be sent.
+ *
+ * @param message The new message
+ */
+ public void message(@Nullable Component message) {
+ this.message = message;
+ }
+ // Paper end
@NotNull
@Override
public HandlerList getHandlers() {