mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-22 04:33:28 +01:00
PlayerPickupItemEvent#setFlyAtPlayer
This commit is contained in:
parent
ccd4375fa5
commit
f5829fec2e
1 changed files with 24 additions and 0 deletions
|
@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Item item;
|
private final Item item;
|
||||||
|
private boolean flyAtPlayer = true; // Paper
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private final int remaining;
|
private final int remaining;
|
||||||
|
|
||||||
|
@ -45,6 +46,28 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||||
return remaining;
|
return remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Set if the item will fly at the player
|
||||||
|
* <p>
|
||||||
|
* Cancelling the event will set this value to false.
|
||||||
|
*
|
||||||
|
* @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 flyAtPlayer;
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancel;
|
return cancel;
|
||||||
|
@ -53,6 +76,7 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||||
@Override
|
@Override
|
||||||
public void setCancelled(boolean cancel) {
|
public void setCancelled(boolean cancel) {
|
||||||
this.cancel = cancel;
|
this.cancel = cancel;
|
||||||
|
this.flyAtPlayer = !cancel; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
Loading…
Add table
Reference in a new issue