mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 07:02:18 -07:00
Finish PlayerPickItemEvent
This commit is contained in:
@@ -67,20 +67,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the slot in which the item that will be put into the players hotbar is located.
|
||||
+ * <p>
|
||||
+ * Returns {@code -1} if the item is not in the player's inventory and should be spawned in if in creative mode.
|
||||
+ *
|
||||
+ * @return player inventory slot (0-35 inclusive)
|
||||
+ * @return player inventory slot (0-35 inclusive, or {@code -1} not taken from the inventory)
|
||||
+ */
|
||||
+ public @Range(from = 0, to = 35) int getSourceSlot() {
|
||||
+ public @Range(from = -1, to = 35) int getSourceSlot() {
|
||||
+ return this.sourceSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the source slot from which the item that will be put in the players hotbar will be taken.
|
||||
+ * <p>
|
||||
+ * 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)
|
||||
+ * @param sourceSlot player inventory slot (0-35 inclusive, or {@code -1} not taken from the inventory)
|
||||
+ */
|
||||
+ 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");
|
||||
+ 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");
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user