mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 23:14:11 +01:00
57dd397155
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
229 lines
6.3 KiB
Diff
229 lines
6.3 KiB
Diff
From 2cb1756d46eb48a7988d0b1980961165f2f3ab8c Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 000000000..118c7b677
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
|
|
@@ -0,0 +1,79 @@
|
|
+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;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+/**
|
|
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
|
+ */
|
|
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
|
+ @Nullable private final Collection<LivingEntity> targets;
|
|
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
|
+
|
|
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @Nullable Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
|
|
+ super(fireball);
|
|
+ this.targets = targets;
|
|
+ this.areaEffectCloud = areaEffectCloud;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The fireball involved in this event
|
|
+ */
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public DragonFireball getEntity() {
|
|
+ return (DragonFireball) super.getEntity();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The living entities hit by fireball
|
|
+ *
|
|
+ * May be null if no entities were hit
|
|
+ *
|
|
+ * @return the targets
|
|
+ */
|
|
+ @Nullable
|
|
+ public Collection<LivingEntity> getTargets() {
|
|
+ return targets;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The area effect cloud spawned in this collision
|
|
+ */
|
|
+ @NotNull
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
+ return areaEffectCloud;
|
|
+ }
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ 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
|
|
index 000000000..1915177f4
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
|
|
@@ -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.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
|
|
+ */
|
|
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
|
|
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
|
+
|
|
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
|
|
+ super(enderDragon);
|
|
+ this.areaEffectCloud = areaEffectCloud;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The enderdragon involved in this event
|
|
+ */
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public EnderDragon getEntity() {
|
|
+ return (EnderDragon) super.getEntity();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The area effect cloud spawned in this collision
|
|
+ */
|
|
+ @NotNull
|
|
+ public AreaEffectCloud getAreaEffectCloud() {
|
|
+ return areaEffectCloud;
|
|
+ }
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ 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
|
|
index 000000000..8414bd805
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
|
|
@@ -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.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when an EnderDragon shoots a fireball
|
|
+ */
|
|
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
|
+ @NotNull private final DragonFireball fireball;
|
|
+
|
|
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
|
|
+ super(entity);
|
|
+ this.fireball = fireball;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The enderdragon shooting the fireball
|
|
+ */
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public EnderDragon getEntity() {
|
|
+ return (EnderDragon) super.getEntity();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The fireball being shot
|
|
+ */
|
|
+ @NotNull
|
|
+ public DragonFireball getFireball() {
|
|
+ return fireball;
|
|
+ }
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ private boolean cancelled = false;
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+}
|
|
--
|
|
2.26.2
|
|
|