Finish converting all events to jspecify annotations
This commit is contained in:
parent
ea00be3aaa
commit
ba3c29b92e
82 changed files with 977 additions and 1103 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerPickItemEvent
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad1533b7b0ca6
|
||||
index 0000000000000000000000000000000000000000..d7e10652918e453838a3a983f089ef4727d0bfe2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java
|
||||
@@ -0,0 +1,96 @@
|
||||
@@ -0,0 +1,93 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
|
@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Event that is fired when a player uses the pick item functionality (middle-clicking a block to get the appropriate
|
||||
|
@ -29,6 +29,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ * <p>
|
||||
+ * Note: This event will not be fired for players in creative mode.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -39,7 +40,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPickItemEvent(@NotNull Player player, int targetSlot, int sourceSlot) {
|
||||
+ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) {
|
||||
+ super(player);
|
||||
+ this.targetSlot = targetSlot;
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
|
@ -50,8 +51,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ *
|
||||
+ * @return hotbar slot (0-8 inclusive)
|
||||
+ */
|
||||
+ @Range(from = 0, to = 8)
|
||||
+ public int getTargetSlot() {
|
||||
+ public @Range(from = 0, to = 8) int getTargetSlot() {
|
||||
+ return this.targetSlot;
|
||||
+ }
|
||||
+
|
||||
|
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ *
|
||||
+ * @param targetSlot hotbar slot (0-8 inclusive)
|
||||
+ */
|
||||
+ public void setTargetSlot(@Range(from = 0, to = 8) int targetSlot) {
|
||||
+ public void setTargetSlot(final @Range(from = 0, to = 8) int targetSlot) {
|
||||
+ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)");
|
||||
+ this.targetSlot = targetSlot;
|
||||
+ }
|
||||
|
@ -70,8 +70,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ *
|
||||
+ * @return player inventory slot (0-35 inclusive)
|
||||
+ */
|
||||
+ @Range(from = 0, to = 35)
|
||||
+ public int getSourceSlot() {
|
||||
+ public @Range(from = 0, to = 35) int getSourceSlot() {
|
||||
+ return this.sourceSlot;
|
||||
+ }
|
||||
+
|
||||
|
@ -80,7 +79,7 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ *
|
||||
+ * @param sourceSlot player inventory slot (0-35 inclusive)
|
||||
+ */
|
||||
+ public void setSourceSlot(@Range(from = 0, to = 35) int sourceSlot) {
|
||||
+ public void setSourceSlot(final @Range(from = 0, to = 35) int sourceSlot) {
|
||||
+ Preconditions.checkArgument(sourceSlot >= 0 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot");
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
+ }
|
||||
|
@ -91,17 +90,15 @@ index 0000000000000000000000000000000000000000..c5987ebea49e4b99c9ff7fa967aad153
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue