mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
Fixup PlayerPickItemEvent docs more
This commit is contained in:
@@ -22,12 +22,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.jspecify.annotations.NullMarked;
|
+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
|
+ * Event that is fired when a player uses the pick item functionality (middle-clicking a block or entity to get the
|
||||||
+ * item). However, note that this event will only trigger if an item has to be moved from the inventory to the hotbar.
|
+ * appropriate item). After the handling of this event, the contents of the source and the target slot will be swapped
|
||||||
+ * After the handling of this event, the contents of the source and the target slot will be swapped and the currently
|
+ * and the currently selected hotbar slot of the player will be set to the target slot.
|
||||||
+ * selected hotbar slot of the player will be set to the target slot.
|
|
||||||
+ * <p>
|
|
||||||
+ * Note: This event will not be fired for players in creative mode.
|
|
||||||
+ */
|
+ */
|
||||||
+@NullMarked
|
+@NullMarked
|
||||||
+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable {
|
+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable {
|
||||||
@@ -68,9 +65,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ /**
|
+ /**
|
||||||
+ * Returns the slot in which the item that will be put into the players hotbar is located.
|
+ * Returns the slot in which the item that will be put into the players hotbar is located.
|
||||||
+ * <p>
|
+ * <p>
|
||||||
+ * Returns {@code -1} if the item is not in the player's inventory and should be spawned in if in creative mode.
|
+ * Returns {@code -1} if the item is not in the player's inventory.
|
||||||
|
+ * If this is the case and the player is in creative mode, the item will be spawned in.
|
||||||
+ *
|
+ *
|
||||||
+ * @return player inventory slot (0-35 inclusive, or {@code -1} not taken from the inventory)
|
+ * @return player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory)
|
||||||
+ */
|
+ */
|
||||||
+ public @Range(from = -1, to = 35) int getSourceSlot() {
|
+ public @Range(from = -1, to = 35) int getSourceSlot() {
|
||||||
+ return this.sourceSlot;
|
+ return this.sourceSlot;
|
||||||
@@ -81,10 +79,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * <p>
|
+ * <p>
|
||||||
+ * If set to {@code -1} and the player is in creative mode, the item will be spawned in.
|
+ * If set to {@code -1} and the player is in creative mode, the item will be spawned in.
|
||||||
+ *
|
+ *
|
||||||
+ * @param sourceSlot player inventory slot (0-35 inclusive, or {@code -1} not taken from the inventory)
|
+ * @param sourceSlot player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory)
|
||||||
+ */
|
+ */
|
||||||
+ public void setSourceSlot(final @Range(from = -1, to = 35) int sourceSlot) {
|
+ public void setSourceSlot(final @Range(from = -1, to = 35) int sourceSlot) {
|
||||||
+ Preconditions.checkArgument(sourceSlot >= -1 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot");
|
+ Preconditions.checkArgument(sourceSlot >= -1 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot, or -1");
|
||||||
+ this.sourceSlot = sourceSlot;
|
+ this.sourceSlot = sourceSlot;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
Reference in New Issue
Block a user