mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
SkeletonHorse Additions
This commit is contained in:
parent
f55cc79973
commit
431acee6c7
2 changed files with 78 additions and 0 deletions
|
@ -0,0 +1,64 @@
|
|||
package com.destroystokyo.paper.event.entity;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.SkeletonHorse;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Event called when a player gets close to a skeleton horse and triggers the lightning trap
|
||||
*/
|
||||
@NullMarked
|
||||
public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final List<HumanEntity> eligibleHumans;
|
||||
private boolean cancelled;
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.Internal
|
||||
public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
|
||||
this(horse, ImmutableList.of());
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
|
||||
super(horse);
|
||||
this.eligibleHumans = eligibleHumans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkeletonHorse getEntity() {
|
||||
return (SkeletonHorse) super.getEntity();
|
||||
}
|
||||
|
||||
public List<HumanEntity> getEligibleHumans() {
|
||||
return this.eligibleHumans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
|
|
@ -43,4 +43,18 @@ public interface SkeletonHorse extends AbstractHorse {
|
|||
* @param trapTime new trap time
|
||||
*/
|
||||
void setTrapTime(int trapTime);
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* @deprecated use {@link #isTrapped()}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isTrap();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setTrapped(boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setTrap(boolean trap);
|
||||
// Paper end
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue