mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 20:23:53 -07:00
[ci skip] Cleanup events (#10202)
This commit is contained in:
@@ -12,11 +12,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+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;
|
||||
+
|
||||
@@ -29,11 +30,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * Note: This event will not be fired for players in creative mode.
|
||||
+ */
|
||||
+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private int targetSlot;
|
||||
+ private int sourceSlot;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPickItemEvent(@NotNull Player player, int targetSlot, int sourceSlot) {
|
||||
+ super(player);
|
||||
+ this.targetSlot = targetSlot;
|
||||
@@ -56,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @param targetSlot hotbar slot (0-8 inclusive)
|
||||
+ */
|
||||
+ public void setTargetSlot(@Range(from = 0, to = 8) int targetSlot) {
|
||||
+ Validate.isTrue(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)");
|
||||
+ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)");
|
||||
+ this.targetSlot = targetSlot;
|
||||
+ }
|
||||
+
|
||||
@@ -76,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @param sourceSlot player inventory slot (0-35 inclusive)
|
||||
+ */
|
||||
+ public void setSourceSlot(@Range(from = 0, to = 35) int sourceSlot) {
|
||||
+ Validate.isTrue(sourceSlot >= 0 && sourceSlot <= 35, "Source slot must be in range of the players inventorys slot ids");
|
||||
+ Preconditions.checkArgument(sourceSlot >= 0 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot");
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user