diff options
author | Jake <[email protected]> | 2021-11-23 17:09:49 -0800 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2021-11-30 19:26:33 +0100 |
commit | e481692afdb08c4486866bc856919c585d6d9646 (patch) | |
tree | 66774ecbddc504c3b0fb9460139b6dc8c367d03d /patches/api/0056-PlayerAttemptPickupItemEvent.patch | |
parent | 7665ae86d65b964822b307c085fc86c0fcc442f2 (diff) | |
download | Paper-e481692afdb08c4486866bc856919c585d6d9646.tar.gz Paper-e481692afdb08c4486866bc856919c585d6d9646.zip |
move extra plugins patch up & more work
Diffstat (limited to 'patches/api/0056-PlayerAttemptPickupItemEvent.patch')
-rw-r--r-- | patches/api/0056-PlayerAttemptPickupItemEvent.patch | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/patches/api/0056-PlayerAttemptPickupItemEvent.patch b/patches/api/0056-PlayerAttemptPickupItemEvent.patch new file mode 100644 index 0000000000..6b504ae688 --- /dev/null +++ b/patches/api/0056-PlayerAttemptPickupItemEvent.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath <[email protected]> +Date: Sun, 11 Jun 2017 16:30:37 -0500 +Subject: [PATCH] PlayerAttemptPickupItemEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0788153a9641e75da565d2e6eee37eeee1cbc61e +--- /dev/null ++++ b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java +@@ -0,0 +1,90 @@ ++package org.bukkit.event.player; ++ ++import org.bukkit.entity.Item; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++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(); ++ @NotNull private final Item item; ++ private final int remaining; ++ private boolean flyAtPlayer = true; ++ private boolean isCancelled = false; ++ ++ @Deprecated // Remove in 1.13 // Remove in 1.14? ++ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item) { ++ this(player, item, 0); ++ } ++ ++ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item, final int remaining) { ++ super(player); ++ this.item = item; ++ this.remaining = remaining; ++ } ++ ++ /** ++ * Gets the Item attempted by the player. ++ * ++ * @return Item ++ */ ++ @NotNull ++ public Item getItem() { ++ return item; ++ } ++ ++ /** ++ * Gets the amount that will remain on the ground, if any ++ * ++ * @return amount that will remain on the ground ++ */ ++ public int getRemaining() { ++ return 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 ++ */ ++ public void setFlyAtPlayer(boolean flyAtPlayer) { ++ this.flyAtPlayer = flyAtPlayer; ++ } ++ ++ /** ++ * Gets if the item will fly at the player ++ * ++ * @return True if the item will fly at the player ++ */ ++ public boolean getFlyAtPlayer() { ++ return this.flyAtPlayer; ++ } ++ ++ ++ @Override ++ public boolean isCancelled() { ++ return this.isCancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.isCancelled = cancel; ++ this.flyAtPlayer = !cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} |