2019-05-27 11:13:41 +02:00
|
|
|
From c3dcb41ecc3c27a968a757ea4dda9a9d35c7661f Mon Sep 17 00:00:00 2001
|
2018-07-28 08:03:10 +02: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
|
2019-04-23 06:47:07 +02:00
|
|
|
index 00000000..118c7b67
|
2018-07-28 08:03:10 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,79 @@
|
2018-07-28 08:03:10 +02: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;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @Nullable private final Collection<LivingEntity> targets;
|
|
|
|
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @Nullable Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
|
2018-07-28 08:03:10 +02:00
|
|
|
+ super(fireball);
|
|
|
|
+ this.targets = targets;
|
|
|
|
+ this.areaEffectCloud = areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The fireball involved in this event
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ @Override
|
|
|
|
+ public DragonFireball getEntity() {
|
|
|
|
+ return (DragonFireball) super.getEntity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The living entities hit by fireball
|
2018-08-17 06:29:16 +02:00
|
|
|
+ *
|
2018-07-28 08:03:10 +02:00
|
|
|
+ * May be null if no entities were hit
|
2018-08-17 06:29:16 +02:00
|
|
|
+ *
|
|
|
|
+ * @return the targets
|
2018-07-28 08:03:10 +02:00
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @Nullable
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public Collection<LivingEntity> getTargets() {
|
|
|
|
+ return targets;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 06:29:16 +02:00
|
|
|
+ * @return The area effect cloud spawned in this collision
|
2018-07-28 08:03:10 +02:00
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
|
|
+ return areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ 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
|
2019-04-23 06:47:07 +02:00
|
|
|
index 00000000..1915177f
|
2018-07-28 08:03:10 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,61 @@
|
2018-07-28 08:03:10 +02:00
|
|
|
+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;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
|
2018-07-28 08:03:10 +02:00
|
|
|
+ super(enderDragon);
|
|
|
|
+ this.areaEffectCloud = areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The enderdragon involved in this event
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ @Override
|
|
|
|
+ public EnderDragon getEntity() {
|
|
|
|
+ return (EnderDragon) super.getEntity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 06:29:16 +02:00
|
|
|
+ * @return The area effect cloud spawned in this collision
|
2018-07-28 08:03:10 +02:00
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
|
|
+ return areaEffectCloud;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ 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
|
2019-04-23 06:47:07 +02:00
|
|
|
index 00000000..8414bd80
|
2018-07-28 08:03:10 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,61 @@
|
2018-07-28 08:03:10 +02:00
|
|
|
+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;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Fired when an EnderDragon shoots a fireball
|
|
|
|
+ */
|
|
|
|
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull private final DragonFireball fireball;
|
2018-07-28 08:03:10 +02:00
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
|
2018-07-28 08:03:10 +02:00
|
|
|
+ super(entity);
|
|
|
|
+ this.fireball = fireball;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The enderdragon shooting the fireball
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ @Override
|
|
|
|
+ public EnderDragon getEntity() {
|
|
|
|
+ return (EnderDragon) super.getEntity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
2018-08-17 06:29:16 +02:00
|
|
|
+ * @return The fireball being shot
|
2018-07-28 08:03:10 +02:00
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public DragonFireball getFireball() {
|
|
|
|
+ return fireball;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-07-28 08:03:10 +02:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean cancelled = false;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancelled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ cancelled = cancel;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2019-03-20 01:28:15 +01:00
|
|
|
2.21.0
|
2018-07-28 08:03:10 +02:00
|
|
|
|