Fix note block sound property on player heads (#9158)

This commit is contained in:
Lulu13022002 2023-05-15 19:32:26 +02:00 committed by GitHub
parent a61b4845f2
commit b6817605ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 27 deletions

View file

@ -178,10 +178,10 @@ index 0000000000000000000000000000000000000000..19202e17f362fdffca472178b102d133
+ }
+}
diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java
index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..51cab9c3ab0293fcc003db8a540a358ba5fadb84 100644
index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..243e5f2debad7f12210169e15ef0b29763e988bb 100644
--- a/src/main/java/org/bukkit/advancement/Advancement.java
+++ b/src/main/java/org/bukkit/advancement/Advancement.java
@@ -19,13 +19,55 @@ public interface Advancement extends Keyed {
@@ -19,13 +19,53 @@ public interface Advancement extends Keyed {
@NotNull
Collection<String> getCriteria();
@ -194,14 +194,9 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..51cab9c3ab0293fcc003db8a540a358b
+ * recipes.
*
- * This includes it's name, description and other visible tags.
+ * This includes its name, description and other visible tags.
*
- * @return a AdvancementDisplay object, or null if not set.
+ * @return the display info
*/
- @Nullable
- AdvancementDisplay getDisplay();
+ @org.jetbrains.annotations.Nullable
+ */
+ @Nullable
+ io.papermc.paper.advancement.AdvancementDisplay getDisplay();
+
+ /**
@ -210,7 +205,8 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..51cab9c3ab0293fcc003db8a540a358b
+ * completes the advancement. Will return the same as
+ * {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an
+ * {@link io.papermc.paper.advancement.AdvancementDisplay} is present.
+ *
*
- * @return a AdvancementDisplay object, or null if not set.
+ * @return the display name
+ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName()
+ */
@ -220,8 +216,9 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..51cab9c3ab0293fcc003db8a540a358b
+ * Gets the parent advancement, if any.
+ *
+ * @return the parent advancement
+ */
+ @org.jetbrains.annotations.Nullable
*/
@Nullable
- AdvancementDisplay getDisplay();
+ Advancement getParent();
+
+ /**

View file

@ -5,11 +5,17 @@ Subject: [PATCH] Fix NotePlayEvent
diff --git a/src/main/java/org/bukkit/event/block/NotePlayEvent.java b/src/main/java/org/bukkit/event/block/NotePlayEvent.java
index a3887067d1b65fb100ac1407a43c455f5d215510..676b31f6f38d4e85cd4bd16ccf42cbc39a5d8423 100644
index a3887067d1b65fb100ac1407a43c455f5d215510..ea7cb75ba3ecbe40e0390fd5568db77de56c4f16 100644
--- a/src/main/java/org/bukkit/event/block/NotePlayEvent.java
+++ b/src/main/java/org/bukkit/event/block/NotePlayEvent.java
@@ -58,9 +58,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
@@ -56,11 +56,13 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
/**
* Overrides the {@link Instrument} to be used.
+ * <p>
+ * Only works when the note block isn't under a player head.
+ * For this specific case the 'note_block_sound' property of the
+ * player head state takes the priority.
*
* @param instrument the Instrument. Has no effect if null.
- * @deprecated no effect on newer Minecraft versions
@ -18,7 +24,7 @@ index a3887067d1b65fb100ac1407a43c455f5d215510..676b31f6f38d4e85cd4bd16ccf42cbc3
public void setInstrument(@NotNull Instrument instrument) {
if (instrument != null) {
this.instrument = instrument;
@@ -71,9 +69,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
@@ -71,9 +73,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
* Overrides the {@link Note} to be played.
*
* @param note the Note. Has no effect if null.