mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
#983: Expose riptide velocity to PlayerRiptideEvent
This commit is contained in:
parent
7ca2b46c1a
commit
f1120ee22d
1 changed files with 19 additions and 1 deletions
|
@ -3,6 +3,7 @@ package org.bukkit.event.player;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,10 +17,17 @@ public class PlayerRiptideEvent extends PlayerEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
|
private final Vector velocity;
|
||||||
|
|
||||||
public PlayerRiptideEvent(@NotNull final Player who, @NotNull final ItemStack item) {
|
public PlayerRiptideEvent(@NotNull final Player who, @NotNull final ItemStack item, @NotNull Vector velocity) {
|
||||||
super(who);
|
super(who);
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
this.velocity = velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public PlayerRiptideEvent(@NotNull final Player who, @NotNull final ItemStack item) {
|
||||||
|
this(who, item, new Vector());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +40,16 @@ public class PlayerRiptideEvent extends PlayerEvent {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the velocity applied to the player as a result of this riptide.
|
||||||
|
*
|
||||||
|
* @return the riptide velocity
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Vector getVelocity() {
|
||||||
|
return velocity.clone();
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue