Begin switching to JSpecify annotations (#11448)

* Begin switching to JSpecify annotations

* more

* fixes
This commit is contained in:
Jake Potrebic 2024-09-29 12:52:13 -07:00 committed by GitHub
parent 6d7a438fad
commit f9c7f2a5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 750 additions and 920 deletions

View file

@ -6,26 +6,26 @@ Subject: [PATCH] Add BlockBreakBlockEvent
diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993eace410d
index 0000000000000000000000000000000000000000..3b130d145f54939ad02e30b15c81120aac2078c2
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
@@ -0,0 +1,61 @@
@@ -0,0 +1,57 @@
+package io.papermc.paper.event.block;
+
+import java.util.List;
+import org.bukkit.block.Block;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockExpEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when a block forces another block to break and drop items.
+ * <p>
+ * Currently called for piston's and liquid flows.
+ */
+@NullMarked
+public class BlockBreakBlockEvent extends BlockExpEvent {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@ -34,18 +34,17 @@ index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993
+ private final List<ItemStack> drops;
+
+ @ApiStatus.Internal
+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List<ItemStack> drops) {
+ public BlockBreakBlockEvent(final Block block, final Block source, final List<ItemStack> drops) {
+ super(block, 0);
+ this.source = source;
+ this.drops = drops;
+ }
+
+ /**
+ * Gets the drops of this event
+ * Gets a mutable list of drops for this event
+ *
+ * @return the drops
+ */
+ @NotNull
+ public List<ItemStack> getDrops() {
+ return this.drops;
+ }
@ -55,18 +54,15 @@ index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993
+ *
+ * @return the source
+ */
+ @NotNull
+ public Block getSource() {
+ return this.source;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }