mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
Add EntityMountEvent and EntityDismount Event
Adapted from Spigot commit ab1e1a2a5a
.
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity stops riding another entity.
|
||||||
|
*/
|
||||||
|
public class EntityDismountEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
private final Entity dismounted;
|
||||||
|
|
||||||
|
public EntityDismountEvent(@NotNull Entity what, @NotNull Entity dismounted) {
|
||||||
|
super(what);
|
||||||
|
this.dismounted = dismounted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity which will no longer be ridden.
|
||||||
|
*
|
||||||
|
* @return dismounted entity
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Entity getDismounted() {
|
||||||
|
return dismounted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,52 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity attempts to ride another entity.
|
||||||
|
*/
|
||||||
|
public class EntityMountEvent extends EntityEvent implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
private final Entity mount;
|
||||||
|
|
||||||
|
public EntityMountEvent(@NotNull Entity what, @NotNull Entity mount) {
|
||||||
|
super(what);
|
||||||
|
this.mount = mount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity which will be ridden.
|
||||||
|
*
|
||||||
|
* @return mounted entity
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Entity getMount() {
|
||||||
|
return mount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user