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
parent fa1f6a5d78
commit 64e918335c
62 changed files with 580 additions and 750 deletions

View File

@@ -12,20 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+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..00000000000000000000000000000000
+ 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..00000000000000000000000000000000
+ *
+ * @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;
+ }