2018-08-27 02:11:49 +08:00
|
|
|
From 5820519ee336a827ab94afff4c21d4e8c51bc7aa Mon Sep 17 00:00:00 2001
|
2018-07-28 14:03:10 +08:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sat, 21 Jul 2018 01:51:05 -0500
|
|
|
|
Subject: [PATCH] EnderDragon Events
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
|
|
|
new file mode 100644
|
2018-08-17 12:29:16 +08:00
|
|
|
index 000000000..ef2a8dab9
|
2018-07-28 14:03:10 +08:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
2018-08-17 12:29:16 +08:00
|
|
|
@@ -0,0 +1,72 @@
|
2018-07-28 14:03:10 +08:00
|
|
|
+package com.destroystokyo.paper.event.entity;
|
|
|
|
+
|
|
|
|
+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 java.util.Collection;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
|
|
|
+ private final Collection<LivingEntity> targets;
|
|
|
|
+ private final AreaEffectCloud areaEffectCloud;
|
|
|
|
+
|
|
|
|
+ public EnderDragonFireballHitEvent(DragonFireball fireball, Collection<LivingEntity> targets, 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
|
2018-08-17 12:29:16 +08:00
|
|
|
+ *
|
2018-07-28 14:03:10 +08:00
|
|
|
+ * May be null if no entities were hit
|
2018-08-17 12:29:16 +08:00
|
|
|
+ *
|
|
|
|
+ * @return the targets
|
2018-07-28 14:03:10 +08:00
|
|
|
+ */
|
|
|
|
+ public Collection<LivingEntity> getTargets() {
|
|
|
|
+ return targets;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 12:29:16 +08:00
|
|
|
+ * @return The area effect cloud spawned in this collision
|
2018-07-28 14:03:10 +08:00
|
|
|
+ */
|
|
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
|
|
+ return areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean cancelled = false;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancelled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ cancelled = cancel;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
|
|
|
new file mode 100644
|
2018-08-17 12:29:16 +08:00
|
|
|
index 000000000..d8c3ab330
|
2018-07-28 14:03:10 +08:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
|
|
|
@@ -0,0 +1,56 @@
|
|
|
|
+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;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
|
|
|
|
+ private final AreaEffectCloud areaEffectCloud;
|
|
|
|
+
|
|
|
|
+ public EnderDragonFlameEvent(EnderDragon enderDragon, AreaEffectCloud areaEffectCloud) {
|
|
|
|
+ super(enderDragon);
|
|
|
|
+ this.areaEffectCloud = areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The enderdragon involved in this event
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public EnderDragon getEntity() {
|
|
|
|
+ return (EnderDragon) super.getEntity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 12:29:16 +08:00
|
|
|
+ * @return The area effect cloud spawned in this collision
|
2018-07-28 14:03:10 +08:00
|
|
|
+ */
|
|
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
|
|
+ return areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean cancelled = false;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancelled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ cancelled = cancel;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
|
|
|
new file mode 100644
|
2018-08-17 12:29:16 +08:00
|
|
|
index 000000000..aa70dda10
|
2018-07-28 14:03:10 +08:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
|
|
|
@@ -0,0 +1,56 @@
|
|
|
|
+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;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when an EnderDragon shoots a fireball
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
|
|
|
+ private final DragonFireball fireball;
|
|
|
|
+
|
|
|
|
+ public EnderDragonShootFireballEvent(EnderDragon entity, DragonFireball fireball) {
|
|
|
|
+ super(entity);
|
|
|
|
+ this.fireball = fireball;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The enderdragon shooting the fireball
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public EnderDragon getEntity() {
|
|
|
|
+ return (EnderDragon) super.getEntity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 12:29:16 +08:00
|
|
|
+ * @return The fireball being shot
|
2018-07-28 14:03:10 +08:00
|
|
|
+ */
|
|
|
|
+ public DragonFireball getFireball() {
|
|
|
|
+ return fireball;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean cancelled = false;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancelled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ cancelled = cancel;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2018-08-17 12:29:16 +08:00
|
|
|
2.18.0
|
2018-07-28 14:03:10 +08:00
|
|
|
|