mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-22 16:39:33 +00:00
This shouldn't be here anymore
This commit is contained in:
30
patches/api/0001-Fix-NotePlayEvent.patch
Normal file
30
patches/api/0001-Fix-NotePlayEvent.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kieran Wallbanks <kieran.wallbanks@gmail.com>
|
||||
Date: Mon, 21 Jun 2021 12:33:45 +0100
|
||||
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
|
||||
--- 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 {
|
||||
* Overrides the {@link Instrument} to be used.
|
||||
*
|
||||
* @param instrument the Instrument. Has no effect if null.
|
||||
- * @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
- @Deprecated
|
||||
public void setInstrument(@NotNull Instrument instrument) {
|
||||
if (instrument != null) {
|
||||
this.instrument = instrument;
|
||||
@@ -71,9 +69,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
* Overrides the {@link Note} to be played.
|
||||
*
|
||||
* @param note the Note. Has no effect if null.
|
||||
- * @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
- @Deprecated
|
||||
public void setNote(@NotNull Note note) {
|
||||
if (note != null) {
|
||||
this.note = note;
|
||||
142
patches/api/0002-More-note-block-events.patch
Normal file
142
patches/api/0002-More-note-block-events.patch
Normal file
@@ -0,0 +1,142 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kieran Wallbanks <kieran.wallbanks@gmail.com>
|
||||
Date: Thu, 11 Feb 2021 13:16:44 +0000
|
||||
Subject: [PATCH] More note block events
|
||||
|
||||
|
||||
diff --git a/src/main/java/ml/beancraft/haricot/event/block/NoteBlockPlaceEvent.java b/src/main/java/ml/beancraft/haricot/event/block/NoteBlockPlaceEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2a22bb7c80884bde59cafaff2b50f99d44504998
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ml/beancraft/haricot/event/block/NoteBlockPlaceEvent.java
|
||||
@@ -0,0 +1,44 @@
|
||||
+package ml.beancraft.haricot.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.data.type.NoteBlock;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class NoteBlockPlaceEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack itemInHand;
|
||||
+ private NoteBlock data;
|
||||
+
|
||||
+ public NoteBlockPlaceEvent(@NotNull Block block, @NotNull NoteBlock data, @NotNull ItemStack itemInHand) {
|
||||
+ super(block);
|
||||
+ this.data = data;
|
||||
+ this.itemInHand = itemInHand;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ItemStack getItemInHand() {
|
||||
+ return itemInHand;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull NoteBlock getData() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ public void setData(@NotNull NoteBlock data) {
|
||||
+ this.data = data;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/ml/beancraft/haricot/event/block/NoteBlockUpdateEvent.java b/src/main/java/ml/beancraft/haricot/event/block/NoteBlockUpdateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c1d8b37cb43d09244014963eb73f64e816d2b1cb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ml/beancraft/haricot/event/block/NoteBlockUpdateEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
+package ml.beancraft.haricot.event.block;
|
||||
+
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.data.type.NoteBlock;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the data of a note block changes. Note that this may not be called for
|
||||
+ * every note block update and might be called multiple times for one cause.
|
||||
+ */
|
||||
+public class NoteBlockUpdateEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final NoteBlock oldData;
|
||||
+ private NoteBlock newData;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ /**
|
||||
+ * Constructs a new note block update event.
|
||||
+ * @param theBlock the block that is being updated
|
||||
+ * @param oldData the data the block had before the update
|
||||
+ * @param newData the data this block is going to have after the update
|
||||
+ */
|
||||
+ public NoteBlockUpdateEvent(@NotNull Block theBlock, @NotNull NoteBlock oldData, @NotNull NoteBlock newData) {
|
||||
+ super(theBlock);
|
||||
+ this.oldData = oldData;
|
||||
+ this.newData = newData;
|
||||
+ this.cancelled = false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data of the note block before the update.
|
||||
+ * @return the data
|
||||
+ */
|
||||
+ public @NotNull NoteBlock getOldData() {
|
||||
+ return this.oldData;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data that the note block will have after this event.
|
||||
+ * @return the data
|
||||
+ */
|
||||
+ public @NotNull NoteBlock getNewData() {
|
||||
+ return this.newData;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the data that the note block will have after this event.
|
||||
+ * @param data the data
|
||||
+ */
|
||||
+ public void setNewData(@NotNull NoteBlock data) {
|
||||
+ Validate.notNull(data, "Data cannot be null");
|
||||
+ this.newData = data;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user