Improve APIs around riptide tridents (#12996)
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
@@ -14,13 +15,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
* N.B. the riptide action is currently performed client side, so manipulating
|
||||
* the player in this event may have undesired effects.
|
||||
*/
|
||||
public class PlayerRiptideEvent extends PlayerEvent {
|
||||
public class PlayerRiptideEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final ItemStack item;
|
||||
private final Vector velocity;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerRiptideEvent(@NotNull final Player player, @NotNull final ItemStack item, @NotNull Vector velocity) {
|
||||
super(player);
|
||||
@@ -54,6 +57,16 @@ public class PlayerRiptideEvent extends PlayerEvent {
|
||||
return this.velocity.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
Reference in New Issue
Block a user