[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -16,23 +16,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Thrown when a player attempts to pick an item up from the ground
+ */
+public class PlayerAttemptPickupItemEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final Item item;
+ private final int remaining;
+ private boolean flyAtPlayer = true;
+ private boolean isCancelled = false;
+
+ private boolean cancelled;
+
+ @Deprecated // Remove in 1.13 // Remove in 1.14?
+ @ApiStatus.Internal
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item) {
+ this(player, item, 0);
+ }
+
+ @ApiStatus.Internal
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item, final int remaining) {
+ super(player);
+ this.item = item;
@@ -46,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public Item getItem() {
+ return item;
+ return this.item;
+ }
+
+ /**
@@ -55,14 +61,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return amount that will remain on the ground
+ */
+ public int getRemaining() {
+ return remaining;
+ return this.remaining;
+ }
+
+ /**
+ * Set if the item will fly at the player
+ * <p>Cancelling the event will set this value to false.</p>
+ *
+ * @param flyAtPlayer True for item to fly at player
+ * @param flyAtPlayer {@code true} for item to fly at player
+ */
+ public void setFlyAtPlayer(boolean flyAtPlayer) {
+ this.flyAtPlayer = flyAtPlayer;
@@ -71,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Gets if the item will fly at the player
+ *
+ * @return True if the item will fly at the player
+ * @return {@code true} if the item will fly at the player
+ */
+ public boolean getFlyAtPlayer() {
+ return this.flyAtPlayer;
@@ -80,23 +86,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.isCancelled = cancel;
+ this.cancelled = cancel;
+ this.flyAtPlayer = !cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}