From 7a71ab650c7f6bbbf6c0f221be8b4ddc29e165c5 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 10 Mar 2024 09:27:41 +1100 Subject: [PATCH] #983: Expose riptide velocity to PlayerRiptideEvent By: 2008Choco --- .../event/player/PlayerRiptideEvent.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerRiptideEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerRiptideEvent.java index c23142a72b..b16fd4433d 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerRiptideEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerRiptideEvent.java @@ -3,6 +3,7 @@ package org.bukkit.event.player; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; /** @@ -16,10 +17,17 @@ public class PlayerRiptideEvent extends PlayerEvent { private static final HandlerList handlers = new HandlerList(); 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); 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; } + /** + * 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 @Override public HandlerList getHandlers() {