mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 06:32:17 -07:00
Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations * more * fixes
This commit is contained in:
@@ -18,12 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is about to be composted by a hopper.
|
||||
+ * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class CompostItemEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
@@ -32,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private boolean willRaiseLevel;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CompostItemEvent(@NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) {
|
||||
+ public CompostItemEvent(final Block composter, final ItemStack item, final boolean willRaiseLevel) {
|
||||
+ super(composter);
|
||||
+ this.item = item;
|
||||
+ this.willRaiseLevel = willRaiseLevel;
|
||||
@@ -43,7 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return the item
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
@@ -62,16 +62,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @param willRaiseLevel {@code true} if the composter should rise a level
|
||||
+ */
|
||||
+ public void setWillRaiseLevel(boolean willRaiseLevel) {
|
||||
+ public void setWillRaiseLevel(final boolean willRaiseLevel) {
|
||||
+ this.willRaiseLevel = willRaiseLevel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
@@ -91,18 +90,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is about to be composted by an entity.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable {
|
||||
+
|
||||
+ private final Entity entity;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityCompostItemEvent(@NotNull Entity entity, @NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) {
|
||||
+ public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final boolean willRaiseLevel) {
|
||||
+ super(composter, item, willRaiseLevel);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
@@ -112,7 +112,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return the entity that composted an item.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
@@ -123,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user