mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
EnderDragon Events
This commit is contained in:
parent
aec70dca41
commit
d8cc2cf7e6
3 changed files with 196 additions and 0 deletions
|
@ -0,0 +1,74 @@
|
|||
package com.destroystokyo.paper.event.entity;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.DragonFireball;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
||||
*/
|
||||
@NullMarked
|
||||
public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final Collection<LivingEntity> targets;
|
||||
private final AreaEffectCloud areaEffectCloud;
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EnderDragonFireballHitEvent(final DragonFireball fireball, final Collection<LivingEntity> targets, final AreaEffectCloud areaEffectCloud) {
|
||||
super(fireball);
|
||||
this.targets = targets;
|
||||
this.areaEffectCloud = areaEffectCloud;
|
||||
}
|
||||
|
||||
/**
|
||||
* The fireball involved in this event
|
||||
*/
|
||||
@Override
|
||||
public DragonFireball getEntity() {
|
||||
return (DragonFireball) super.getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* The living entities hit by fireball
|
||||
*
|
||||
* @return the targets
|
||||
*/
|
||||
public Collection<LivingEntity> getTargets() {
|
||||
return this.targets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The area effect cloud spawned in this collision
|
||||
*/
|
||||
public AreaEffectCloud getAreaEffectCloud() {
|
||||
return this.areaEffectCloud;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.destroystokyo.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
|
||||
*/
|
||||
@NullMarked
|
||||
public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final AreaEffectCloud areaEffectCloud;
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EnderDragonFlameEvent(final EnderDragon enderDragon, final AreaEffectCloud areaEffectCloud) {
|
||||
super(enderDragon);
|
||||
this.areaEffectCloud = areaEffectCloud;
|
||||
}
|
||||
|
||||
/**
|
||||
* The enderdragon involved in this event
|
||||
*/
|
||||
@Override
|
||||
public EnderDragon getEntity() {
|
||||
return (EnderDragon) super.getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The area effect cloud spawned in this collision
|
||||
*/
|
||||
public AreaEffectCloud getAreaEffectCloud() {
|
||||
return this.areaEffectCloud;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.destroystokyo.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.DragonFireball;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Fired when an EnderDragon shoots a fireball
|
||||
*/
|
||||
@NullMarked
|
||||
public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final DragonFireball fireball;
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EnderDragonShootFireballEvent(final EnderDragon entity, final DragonFireball fireball) {
|
||||
super(entity);
|
||||
this.fireball = fireball;
|
||||
}
|
||||
|
||||
/**
|
||||
* The enderdragon shooting the fireball
|
||||
*/
|
||||
@Override
|
||||
public EnderDragon getEntity() {
|
||||
return (EnderDragon) super.getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The fireball being shot
|
||||
*/
|
||||
public DragonFireball getFireball() {
|
||||
return this.fireball;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue